Skip to content

Commit

Permalink
Replace duplicate test assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
westonruter committed Aug 30, 2018
1 parent 1870954 commit d73ab0d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions tests/test-class-amp-http.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,22 +175,22 @@ public function test_send_cors_headers() {
AMP_HTTP::send_cors_headers();
$this->assertEmpty( AMP_HTTP::$headers_sent );

// Origin header is not allowed.
// Try an invalid Origin header.
AMP_HTTP::$headers_sent = array();
AMP_HTTP::$purged_amp_query_vars = array();
$_SERVER['HTTP_ORIGIN'] = 'https://evil.example.com';
AMP_HTTP::send_cors_headers();
$this->assertEmpty( AMP_HTTP::$headers_sent );

// The __amp_source_origin is not allowed.
// Try an invalid __amp_source_origin.
AMP_HTTP::$headers_sent = array();
AMP_HTTP::$purged_amp_query_vars = array();
unset( $_SERVER['HTTP_ORIGIN'] );
$_GET['__amp_source_origin'] = 'https://evil.example.com';
AMP_HTTP::send_cors_headers();
$this->assertEmpty( AMP_HTTP::$headers_sent );

// The origin header is allowed.
// Try an allowed Origin header.
AMP_HTTP::$headers_sent = array();
AMP_HTTP::$purged_amp_query_vars = array();
$_SERVER['HTTP_ORIGIN'] = home_url();
Expand Down
2 changes: 1 addition & 1 deletion tests/test-class-amp-theme-support.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function test_init() {
$_GET['__amp_source_origin'] = 'foo';
AMP_Theme_Support::init();
$this->assertFalse( has_action( 'widgets_init', array( self::TESTED_CLASS, 'register_widgets' ) ) );
$this->assertFalse( has_action( 'widgets_init', array( self::TESTED_CLASS, 'register_widgets' ) ) );
$this->assertFalse( has_action( 'wp', array( self::TESTED_CLASS, 'finish_init' ) ) );

add_theme_support( 'amp' );
AMP_Theme_Support::init();
Expand Down

0 comments on commit d73ab0d

Please sign in to comment.