Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use strict comparisons in AMP_Tag_And_Attribute_Sanitizer_Attr_Spec_Rules_Test #999

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions tests/amp-tag-and-attribute-sanitizer-private-methods-tests.php
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ public function test_validate_attr_spec_rules( $data, $expected ) {

$got = $this->invoke_method( $sanitizer, $data['func_name'], array( $node, $data['attribute_name'], $attr_spec_rule ) );

if ( $expected != $got ) {
if ( $expected !== $got ) {
printf( 'using source: %s' . PHP_EOL, $source );
var_dump( $data );
}
Expand Down Expand Up @@ -566,7 +566,7 @@ public function test_is_allowed_attribute( $data, $expected ) {

$got = $this->invoke_method( $sanitizer, $data['func_name'], array( $data['attribute_name'], $attr_spec_list ) );

if ( $expected != $got ) {
if ( $expected !== $got ) {
printf( 'using source: %s' . PHP_EOL, $source );
var_dump( $data );
}
Expand Down Expand Up @@ -662,7 +662,7 @@ public function test_remove_node( $data, $expected ) {

$got = AMP_DOM_Utils::get_content_from_dom( $dom );

if ( $expected != $got ) {
if ( $expected !== $got ) {
printf( 'using source: %s' . PHP_EOL, $data['source'] );
var_dump( $data );
printf( 'got = %s' .PHP_EOL, $got );
Expand Down Expand Up @@ -803,7 +803,7 @@ public function test_replace_node_with_children( $data, $expected ) {
$got = AMP_DOM_Utils::get_content_from_dom( $dom );
$got = preg_replace( '/(?<=>)\s+(?=<)/', '', $got );

if ( $expected != $got ) {
if ( $expected !== $got ) {
printf( 'using source: %s' . PHP_EOL, $data['source'] );
var_dump( $data );
printf( 'got = %s' .PHP_EOL, $got );
Expand Down Expand Up @@ -865,7 +865,7 @@ public function test_get_ancestor_with_tag_name( $data, $expected ) {

$got = $this->invoke_method( $sanitizer, 'get_ancestor_with_tag_name', array( $node, $data['ancestor_tag_name'] ) );

if ( $ancestor_node != $got ) {
if ( $ancestor_node !== $got ) {
printf( 'using source: %s' . PHP_EOL, $data['source'] );
var_dump( $data );
}
Expand Down Expand Up @@ -1071,7 +1071,7 @@ public function test_validate_attr_spec_list_for_node( $data, $expected ) {

$got = $this->invoke_method( $sanitizer, 'validate_attr_spec_list_for_node', array( $node, $data['attr_spec_list'] ) );

if ( $expected != $got ) {
if ( $expected !== $got ) {
printf( 'using source: %s' . PHP_EOL, $data['source'] );
var_dump( $data );
}
Expand Down Expand Up @@ -1198,7 +1198,7 @@ public function test_check_attr_spec_rule_value( $data, $expected ) {

$got = $this->invoke_method( $sanitizer, 'check_attr_spec_rule_value', array( $node, $data['attr_name'], $data['attr_spec_rule'] ) );

if ( $expected != $got ) {
if ( $expected !== $got ) {
printf( 'using source: %s' . PHP_EOL, $data['source'] );
var_dump( $data );
}
Expand Down Expand Up @@ -1350,7 +1350,7 @@ public function test_check_attr_spec_rule_value_casei( $data, $expected ) {

$got = $this->invoke_method( $sanitizer, 'check_attr_spec_rule_value_casei', array( $node, $data['attr_name'], $data['attr_spec_rule'] ) );

if ( $expected != $got ) {
if ( $expected !== $got ) {
printf( 'using source: %s' . PHP_EOL, $data['source'] );
var_dump( $data );
}
Expand Down Expand Up @@ -1444,7 +1444,7 @@ public function test_check_attr_spec_rule_blacklisted_value_regex( $data, $expec

$got = $this->invoke_method( $sanitizer, 'check_attr_spec_rule_blacklisted_value_regex', array( $node, $data['attr_name'], $data['attr_spec_rule'] ) );

if ( $expected != $got ) {
if ( $expected !== $got ) {
printf( 'using source: %s' . PHP_EOL, $data['source'] );
var_dump( $data );
}
Expand Down Expand Up @@ -1579,7 +1579,7 @@ public function test_check_attr_spec_rule_allowed_protocol( $data, $expected ) {

$got = $this->invoke_method( $sanitizer, 'check_attr_spec_rule_allowed_protocol', array( $node, $data['attr_name'], $data['attr_spec_rule'] ) );

if ( $expected != $got ) {
if ( $expected !== $got ) {
printf( 'using source: %s' . PHP_EOL, $data['source'] );
var_dump( $data );
}
Expand Down Expand Up @@ -1728,7 +1728,7 @@ public function test_check_attr_spec_rule_disallowed_relative( $data, $expected

$got = $this->invoke_method( $sanitizer, 'check_attr_spec_rule_disallowed_relative', array( $node, $data['attr_name'], $data['attr_spec_rule'] ) );

if ( $expected != $got ) {
if ( $expected !== $got ) {
printf( 'using source: %s' . PHP_EOL, $data['source'] );
var_dump( $data );
}
Expand Down