Skip to content

Commit

Permalink
Change mock builder usage to createMock to improve type inference
Browse files Browse the repository at this point in the history
Signed-off-by: George Steel <[email protected]>
  • Loading branch information
gsteel committed Jun 13, 2022
1 parent d2053b7 commit 4f0f815
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions test/FactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,7 @@ public function testCreateInputWithInvalidDataTypeThrowsInvalidArgumentException
public function testCreateInputWithTypeAsAnUnknownPluginAndNotExistsAsClassNameThrowException(): void
{
$type = 'foo';
/** @var InputFilterPluginManager&MockObject $pluginManager */
$pluginManager = $this->getMockBuilder(InputFilterPluginManager::class)
->disableOriginalConstructor()
->getMock();
$pluginManager = $this->createMock(InputFilterPluginManager::class);
$pluginManager->expects($this->atLeastOnce())
->method('has')
->with($type)
Expand All @@ -69,19 +66,15 @@ public function testCreateInputWithTypeAsAnUnknownPluginAndNotExistsAsClassNameT

public function testGetInputFilterManagerSettedByItsSetter(): void
{
$pluginManager = $this->getMockBuilder(InputFilterPluginManager::class)
->disableOriginalConstructor()
->getMock();
$pluginManager = $this->createMock(InputFilterPluginManager::class);
$factory = new Factory();
$factory->setInputFilterManager($pluginManager);
$this->assertSame($pluginManager, $factory->getInputFilterManager());
}

public function testGetInputFilterManagerWhenYouConstructFactoryWithIt(): void
{
$pluginManager = $this->getMockBuilder(InputFilterPluginManager::class)
->disableOriginalConstructor()
->getMock();
$pluginManager = $this->createMock(InputFilterPluginManager::class);
$factory = new Factory($pluginManager);
$this->assertSame($pluginManager, $factory->getInputFilterManager());
}
Expand Down

0 comments on commit 4f0f815

Please sign in to comment.