Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Commit

Permalink
use assertArraySubset instead of helper function
Browse files Browse the repository at this point in the history
  • Loading branch information
pfefferle committed Apr 30, 2022
1 parent fc03017 commit b32f8f0
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions tests/test-microformats.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,7 @@
<?php
class MicroformatsTest extends WP_UnitTestCase {

public static function assert_array_subset( array $expectation, array $reality, $strict = false, $message = '' ) {
foreach ( $expectation as $key => $value ) {
self::assertArrayHasKey( $key, $reality, $message );
if ( is_array( $value ) ) {
self::assert_array_subset( $value, $reality[ $key ], $strict, $message . '[' . $key . ']' );
} else {
self::assertEquals( $value, $reality[ $key ], $message . '[' . $key . ']' );
}
}
}

/**
* @dataProvider templateProvider
* @dataProvider template_provider
*/
public function test_interpreter( $path ) {
$comment = Linkbacks_MF2_Handler::generate_commentdata(
Expand All @@ -27,10 +15,10 @@ public function test_interpreter( $path ) {
);

$subset = json_decode( file_get_contents( substr( $path, 0, -4 ) . 'json' ), true );
$this->assert_array_subset( $subset, $comment );
$this->assertArraySubset( $subset, $comment );
}

public function templateProvider() {
public function template_provider() {
return array_map(
function( $path ) {
return array( $path ); },
Expand Down

0 comments on commit b32f8f0

Please sign in to comment.