Skip to content

Commit

Permalink
Tests: Proper typing of $this->class in unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pprkut committed Oct 30, 2023
1 parent 3250545 commit e8486f0
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/Lunr/Core/Tests/ConfigServiceLocatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,33 @@ abstract class ConfigServiceLocatorTest extends LunrBaseTest
*/
protected $configuration;

/**
* Instance of the tested class.
* @var ConfigServiceLocator
*/
protected ConfigServiceLocator $class;

/**
* Testcase Constructor.
*/
public function setUp(): void
{
$this->configuration = $this->getMockBuilder('Lunr\Core\Configuration')->getMock();

$this->class = new ConfigServiceLocator($this->configuration);
$this->reflection = new ReflectionClass('Lunr\Core\ConfigServiceLocator');
$this->class = new ConfigServiceLocator($this->configuration);

parent::baseSetUp($this->class);
}

/**
* Testcase Destructor.
*/
public function tearDown(): void
{
//unset doesn't call __destruct() for some reason
$this->class->__destruct();
unset($this->class);
unset($this->reflection);
unset($this->configuration);

parent::tearDown();
}

/**
Expand Down

0 comments on commit e8486f0

Please sign in to comment.