Skip to content

Commit

Permalink
Update Plugins_Factory_Test to actually test the factory
Browse files Browse the repository at this point in the history
  • Loading branch information
freibergergarcia committed Oct 1, 2023
1 parent d346cbc commit 5fee7d9
Showing 1 changed file with 7 additions and 34 deletions.
41 changes: 7 additions & 34 deletions tests/unit/Plugin_Factory_Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace WordPress_Related\Tests\Unit;

use PHPUnit\Framework\MockObject\Exception;
use PHPUnit\Framework\TestCase;
use WordPress_Related\Plugin_Factory;
use DI\Container;
Expand All @@ -16,45 +15,19 @@
*/
class Plugin_Factory_Test extends TestCase {

/**
* Container.
*
* @since 1.0.0
* @var Container
*/
protected Container $container;

/**
* Set up.
*
* @return void
* @throws Exception
* @since 1.0.0
*/
public function setUp(): void {
parent::setUp();
$this->container = $this->createMock( 'DI\Container' );
}

/**
* Test plugin factory create.
*
* @return void
* @since 1.0.0
*/
public function test_plugin_factory_create(): void {
$plugin = Plugin_Factory::create( $this->container );
$this->assertInstanceOf( 'WordPress_Related\Plugin', $plugin );
}
$container = $this->createMock( Container::class );

/**
* Tear down.
*
* @return void
* @since 1.0.0
*/
public function tearDown(): void {
parent::tearDown();
unset( $this->container );
$plugin_instance_one = Plugin_Factory::create( $container );
$plugin_instance_two = Plugin_Factory::create( $container );

$this->assertInstanceOf( 'WordPress_Related\Plugin', $plugin_instance_one );
$this->assertInstanceOf( 'WordPress_Related\Plugin', $plugin_instance_two );
$this->assertSame( $plugin_instance_one, $plugin_instance_two );
}
}

0 comments on commit 5fee7d9

Please sign in to comment.