Skip to content

Commit 7f79c18

Browse files
authored
Merge pull request #375 from lloc/raise-coverage
Tests added
2 parents 593de3a + 113476c commit 7f79c18

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

tests/phpunit/TestMslsOptionsTax.php

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,36 @@
44

55
use Brain\Monkey\Functions;
66
use lloc\Msls\MslsOptionsTax;
7+
use lloc\Msls\MslsOptionsTaxTerm;
8+
use lloc\Msls\MslsOptionsTaxTermCategory;
79

810
class TestMslsOptionsTax extends MslsUnitTestCase {
911

10-
protected $woo;
11-
1212
protected function setUp(): void {
1313
parent::setUp();
1414

15-
Functions\expect( 'get_option' )->once()->andReturn( array( 'de_DE' => 42 ) );
15+
Functions\expect( 'get_option' )->atLeast()->once()->andReturn( array( 'de_DE' => 42 ) );
1616

1717
$this->test = new MslsOptionsTax( 0 );
1818
}
1919

20+
public function test_create_category(): void {
21+
Functions\expect( 'get_queried_object_id' )->once()->andReturn( 42 );
22+
Functions\expect( 'is_admin' )->once()->andReturnFalse();
23+
Functions\expect( 'is_category' )->once()->andReturnTrue();
24+
25+
$this->assertInstanceOf( MslsOptionsTaxTermCategory::class, MslsOptionsTax::create() );
26+
}
27+
28+
public function test_create_post_tag(): void {
29+
Functions\expect( 'get_queried_object_id' )->once()->andReturn( 42 );
30+
Functions\expect( 'is_admin' )->once()->andReturnFalse();
31+
Functions\expect( 'is_category' )->once()->andReturnFalse();
32+
Functions\expect( 'is_tag' )->once()->andReturnTrue();
33+
34+
$this->assertInstanceOf( MslsOptionsTaxTerm::class, MslsOptionsTax::create() );
35+
}
36+
2037
public function test_get_tax_query(): void {
2138
Functions\expect( 'is_woocommerce' )->once()->andReturn( false );
2239

0 commit comments

Comments
 (0)