-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Unit test SV_WC_Plugin::logger method
- Loading branch information
1 parent
55c5334
commit 5caffd5
Showing
1 changed file
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
namespace SkyVerge\WooCommerce\PluginFramework\v5_14_0\Tests\Unit; | ||
|
||
use Mockery; | ||
use ReflectionException; | ||
use SkyVerge\WooCommerce\PluginFramework\v5_14_0\SV_WC_Plugin; | ||
use SkyVerge\WooCommerce\PluginFramework\v5_14_0\Tests\TestCase; | ||
use WP_Mock; | ||
|
||
/** | ||
* @covers \SkyVerge\WooCommerce\PluginFramework\v5_14_0\SV_WC_Plugin | ||
*/ | ||
class PluginTest extends TestCase | ||
{ | ||
/** | ||
* @var Mockery\MockInterface&SV_WC_Plugin | ||
*/ | ||
private $testObject; | ||
|
||
public function setUp() : void | ||
{ | ||
parent::setUp(); | ||
|
||
$this->testObject = Mockery::mock(SV_WC_Plugin::class) | ||
->shouldAllowMockingProtectedMethods() | ||
->makePartial(); | ||
} | ||
|
||
/** | ||
* @covers \SkyVerge\WooCommerce\PluginFramework\v5_14_0\SV_WC_Plugin::logger() | ||
* @throws ReflectionException | ||
*/ | ||
public function testCanGetLogger() : void | ||
{ | ||
WP_Mock::userFunction('wc_get_logger') | ||
->once() | ||
->andReturn($logger = Mockery::mock('WC_Logger_Interface')); | ||
|
||
$this->assertSame( | ||
$logger, | ||
$this->invokeInaccessibleMethod($this->testObject, 'logger') | ||
); | ||
|
||
$this->assertSame( | ||
$logger, | ||
$this->invokeInaccessibleMethod($this->testObject, 'logger') | ||
); | ||
} | ||
} |