Skip to content

Commit

Permalink
QA: use the most specific PHPUnit assertion possible (#200)
Browse files Browse the repository at this point in the history
QA: use the most specific PHPUnit assertion possible
  • Loading branch information
IreneStr authored May 21, 2019
2 parents a01fa9a + 33f0b39 commit 17d3f2a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
4 changes: 2 additions & 2 deletions tests/php/unit/Configuration/configuration-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function testEmpty() {
$configuration->to_array()
);

$this->assertEquals( Filters\applied( 'acf/get_info' ), 1 );
$this->assertSame( Filters\applied( 'acf/get_info' ), 1 );
}

/**
Expand All @@ -79,7 +79,7 @@ public function testACF5VersionFunction() {
);
$config = $configuration->to_array();

$this->assertEquals( $acf_version, $config['acfVersion'] );
$this->assertSame( $acf_version, $config['acfVersion'] );
}

/**
Expand Down
18 changes: 14 additions & 4 deletions tests/php/unit/Configuration/string-store-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ protected function getStore() {
* @return void
*/
public function testEmpty() {
$store = $this->getStore();
$this->assertEmpty( $store->to_array() );
$store = $this->getStore();
$result = $store->to_array();

$this->assertInternalType( 'array', $result );
$this->assertEmpty( $result );
}

/**
Expand Down Expand Up @@ -103,7 +106,11 @@ public function testAddNonString() {
$store = $this->getStore();

$this->assertFalse( $store->add( 999 ) );
$this->assertEmpty( $store->to_array() );

$result = $store->to_array();

$this->assertInternalType( 'array', $result );
$this->assertEmpty( $result );
}

/**
Expand All @@ -129,7 +136,10 @@ public function testRemove() {

$store->remove( $type_b );

$this->assertEmpty( $store->to_array() );
$result = $store->to_array();

$this->assertInternalType( 'array', $result );
$this->assertEmpty( $result );
}

/**
Expand Down
6 changes: 4 additions & 2 deletions tests/php/unit/main-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ public function testInvalidConfig() {
$testee = new \AC_Yoast_SEO_ACF_Content_Analysis();
$testee->boot();

$this->assertNotSame( 'Invalid Config', $registry->get( 'config' ) );
$this->assertInstanceOf( \Yoast_ACF_Analysis_Configuration::class, $registry->get( 'config' ) );
$result = $registry->get( 'config' );

$this->assertNotSame( 'Invalid Config', $result );
$this->assertInstanceOf( \Yoast_ACF_Analysis_Configuration::class, $result );
}
}

0 comments on commit 17d3f2a

Please sign in to comment.