Skip to content
This repository was archived by the owner on Jan 30, 2020. It is now read-only.

Commit 88f04b6

Browse files
committed
Updated tests - use callback notation for prophecies
1 parent f66ee23 commit 88f04b6

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

test/ModuleTest.php

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,14 @@
1111
use PHPUnit\Framework\TestCase;
1212
use Zend\InputFilter\InputFilterAbstractServiceFactory;
1313
use Zend\InputFilter\InputFilterPluginManager;
14-
use Zend\InputFilter\InputFilterPluginManagerFactory;
1514
use Zend\InputFilter\Module;
1615

1716
class ModuleTest extends TestCase
1817
{
1918
/** @var Module */
2019
private $module;
2120

22-
public function setUp()
21+
protected function setUp()
2322
{
2423
$this->module = new Module();
2524
}
@@ -70,9 +69,7 @@ public function testInputFilterConfigShouldContainAbstractServiceFactory()
7069
public function testInitMethodShouldRegisterPluginManagerSpecificationWithServiceListener()
7170
{
7271
// Service listener
73-
$serviceListener = $this->prophesize(
74-
TestAsset\ServiceListenerInterface::class
75-
);
72+
$serviceListener = $this->prophesize(TestAsset\ServiceListenerInterface::class);
7673
$serviceListener->addServiceManager(
7774
'InputFilterManager',
7875
'input_filters',
@@ -82,19 +79,15 @@ public function testInitMethodShouldRegisterPluginManagerSpecificationWithServic
8279

8380
// Container
8481
$container = $this->prophesize(ContainerInterface::class);
85-
$container->get('ServiceListener')->willReturn(
86-
$serviceListener->reveal()
87-
);
82+
$container->get('ServiceListener')->will([$serviceListener, 'reveal']);
8883

8984
// Event
9085
$event = $this->prophesize(TestAsset\ModuleEventInterface::class);
91-
$event->getParam('ServiceManager')->willReturn($container->reveal());
86+
$event->getParam('ServiceManager')->will([$container, 'reveal']);
9287

9388
// Module manager
94-
$moduleManager = $this->prophesize(
95-
TestAsset\ModuleManagerInterface::class
96-
);
97-
$moduleManager->getEvent()->willReturn($event->reveal());
89+
$moduleManager = $this->prophesize(TestAsset\ModuleManagerInterface::class);
90+
$moduleManager->getEvent()->will([$event, 'reveal']);
9891

9992
$this->assertNull($this->module->init($moduleManager->reveal()));
10093
}

0 commit comments

Comments
 (0)