9
9
10
10
use Interop \Container \ContainerInterface ;
11
11
use PHPUnit_Framework_TestCase as TestCase ;
12
- use Zend \Mvc \Controller \LazyControllerFactory ;
12
+ use Zend \Mvc \Controller \LazyControllerAbstractFactory ;
13
13
use Zend \ServiceManager \Exception \ServiceNotFoundException ;
14
14
use Zend \Validator \ValidatorPluginManager ;
15
15
16
- class LazyControllerFactoryTest extends TestCase
16
+ class LazyControllerAbstractFactoryTest extends TestCase
17
17
{
18
18
public function setUp ()
19
19
{
@@ -41,34 +41,34 @@ public function nonClassRequestedNames()
41
41
*/
42
42
public function testCanCreateReturnsFalseForNonClassRequestedNames ($ requestedName )
43
43
{
44
- $ factory = new LazyControllerFactory ();
44
+ $ factory = new LazyControllerAbstractFactory ();
45
45
$ this ->assertFalse ($ factory ->canCreate ($ this ->container ->reveal (), $ requestedName ));
46
46
}
47
47
48
48
public function testCanCreateReturnsFalseForClassesThatDoNotImplementDispatchableInterface ()
49
49
{
50
- $ factory = new LazyControllerFactory ();
50
+ $ factory = new LazyControllerAbstractFactory ();
51
51
$ this ->assertFalse ($ factory ->canCreate ($ this ->container ->reveal (), __CLASS__ ));
52
52
}
53
53
54
54
public function testFactoryInstantiatesClassDirectlyIfItHasNoConstructor ()
55
55
{
56
- $ factory = new LazyControllerFactory ();
56
+ $ factory = new LazyControllerAbstractFactory ();
57
57
$ controller = $ factory ($ this ->container ->reveal (), TestAsset \SampleController::class);
58
58
$ this ->assertInstanceOf (TestAsset \SampleController::class, $ controller );
59
59
}
60
60
61
61
public function testFactoryInstantiatesClassDirectlyIfConstructorHasNoArguments ()
62
62
{
63
- $ factory = new LazyControllerFactory ();
63
+ $ factory = new LazyControllerAbstractFactory ();
64
64
$ controller = $ factory ($ this ->container ->reveal (), TestAsset \ControllerWithEmptyConstructor::class);
65
65
$ this ->assertInstanceOf (TestAsset \ControllerWithEmptyConstructor::class, $ controller );
66
66
}
67
67
68
68
public function testFactoryRaisesExceptionWhenUnableToResolveATypeHintedService ()
69
69
{
70
70
$ this ->container ->has (TestAsset \SampleInterface::class)->willReturn (false );
71
- $ factory = new LazyControllerFactory ();
71
+ $ factory = new LazyControllerAbstractFactory ();
72
72
$ this ->setExpectedException (
73
73
ServiceNotFoundException::class,
74
74
sprintf (
@@ -82,7 +82,7 @@ public function testFactoryRaisesExceptionWhenUnableToResolveATypeHintedService(
82
82
83
83
public function testFactoryPassesNullForScalarParameters ()
84
84
{
85
- $ factory = new LazyControllerFactory ();
85
+ $ factory = new LazyControllerAbstractFactory ();
86
86
$ controller = $ factory ($ this ->container ->reveal (), TestAsset \ControllerWithScalarParameters::class);
87
87
$ this ->assertInstanceOf (TestAsset \ControllerWithScalarParameters::class, $ controller );
88
88
$ this ->assertNull ($ controller ->foo );
@@ -95,7 +95,7 @@ public function testFactoryInjectsConfigServiceForConfigArgumentsTypeHintedAsArr
95
95
$ this ->container ->has ('config ' )->willReturn (true );
96
96
$ this ->container ->get ('config ' )->willReturn ($ config );
97
97
98
- $ factory = new LazyControllerFactory ();
98
+ $ factory = new LazyControllerAbstractFactory ();
99
99
$ controller = $ factory ($ this ->container ->reveal (), TestAsset \ControllerAcceptingConfigToConstructor::class);
100
100
$ this ->assertInstanceOf (TestAsset \ControllerAcceptingConfigToConstructor::class, $ controller );
101
101
$ this ->assertEquals ($ config , $ controller ->config );
@@ -107,7 +107,7 @@ public function testFactoryCanInjectKnownTypeHintedServices()
107
107
$ this ->container ->has (TestAsset \SampleInterface::class)->willReturn (true );
108
108
$ this ->container ->get (TestAsset \SampleInterface::class)->willReturn ($ sample );
109
109
110
- $ factory = new LazyControllerFactory ();
110
+ $ factory = new LazyControllerAbstractFactory ();
111
111
$ controller = $ factory ($ this ->container ->reveal (), TestAsset \ControllerWithTypeHintedConstructorParameter::class);
112
112
$ this ->assertInstanceOf (TestAsset \ControllerWithTypeHintedConstructorParameter::class, $ controller );
113
113
$ this ->assertSame ($ sample , $ controller ->sample );
@@ -119,7 +119,7 @@ public function testFactoryResolvesTypeHintsForServicesToWellKnownServiceNames()
119
119
$ this ->container ->has ('ValidatorManager ' )->willReturn (true );
120
120
$ this ->container ->get ('ValidatorManager ' )->willReturn ($ validators );
121
121
122
- $ factory = new LazyControllerFactory ();
122
+ $ factory = new LazyControllerAbstractFactory ();
123
123
$ controller = $ factory (
124
124
$ this ->container ->reveal (),
125
125
TestAsset \ControllerAcceptingWellKnownServicesAsConstructorParameters::class
@@ -145,7 +145,7 @@ public function testFactoryCanSupplyAMixOfParameterTypes()
145
145
$ this ->container ->has ('config ' )->willReturn (true );
146
146
$ this ->container ->get ('config ' )->willReturn ($ config );
147
147
148
- $ factory = new LazyControllerFactory ();
148
+ $ factory = new LazyControllerAbstractFactory ();
149
149
$ controller = $ factory ($ this ->container ->reveal (), TestAsset \ControllerWithMixedConstructorParameters::class);
150
150
$ this ->assertInstanceOf (TestAsset \ControllerWithMixedConstructorParameters::class, $ controller );
151
151
0 commit comments