◆ badServiceDefinitionProvider()
Pimple\Tests\PimpleTest::badServiceDefinitionProvider |
( |
| ) |
|
Provider for invalid service definitions.
Definition at line 339 of file PimpleTest.php.
343 array(
new Fixtures\NonInvokable()),
◆ serviceDefinitionProvider()
Pimple\Tests\PimpleTest::serviceDefinitionProvider |
( |
| ) |
|
Provider for service definitions.
Definition at line 350 of file PimpleTest.php.
353 array(
function ($value) {
354 $service =
new Fixtures\Service();
355 $service->value = $value;
359 array(
new Fixtures\Invokable()),
◆ settingAnInvokableObjectShouldTreatItAsFactory()
Pimple\Tests\PimpleTest::settingAnInvokableObjectShouldTreatItAsFactory |
( |
| ) |
|
- Test:
Definition at line 273 of file PimpleTest.php.
275 $pimple =
new Container();
276 $pimple[
'invokable'] =
new Fixtures\Invokable();
278 $this->assertInstanceOf(
'Pimple\Tests\Fixtures\Service', $pimple[
'invokable']);
◆ settingNonInvokableObjectShouldTreatItAsParameter()
Pimple\Tests\PimpleTest::settingNonInvokableObjectShouldTreatItAsParameter |
( |
| ) |
|
- Test:
Definition at line 282 of file PimpleTest.php.
284 $pimple =
new Container();
285 $pimple[
'non_invokable'] =
new Fixtures\NonInvokable();
287 $this->assertInstanceOf(
'Pimple\Tests\Fixtures\NonInvokable', $pimple[
'non_invokable']);
◆ testConstructorInjection()
Pimple\Tests\PimpleTest::testConstructorInjection |
( |
| ) |
|
◆ testDefiningNewServiceAfterFreeze()
Pimple\Tests\PimpleTest::testDefiningNewServiceAfterFreeze |
( |
| ) |
|
Definition at line 363 of file PimpleTest.php.
365 $pimple =
new Container();
366 $pimple[
'foo'] =
function () {
369 $foo = $pimple[
'foo'];
371 $pimple[
'bar'] =
function () {
374 $this->assertSame(
'bar', $pimple[
'bar']);
◆ testExtend()
Pimple\Tests\PimpleTest::testExtend |
( |
|
$service | ) |
|
serviceDefinitionProvider
Definition at line 206 of file PimpleTest.php.
208 $pimple =
new Container();
209 $pimple[
'shared_service'] =
function () {
210 return new Fixtures\Service();
212 $pimple[
'factory_service'] = $pimple->factory(
function () {
213 return new Fixtures\Service();
216 $pimple->extend(
'shared_service', $service);
217 $serviceOne = $pimple[
'shared_service'];
218 $this->assertInstanceOf(
'Pimple\Tests\Fixtures\Service', $serviceOne);
219 $serviceTwo = $pimple[
'shared_service'];
220 $this->assertInstanceOf(
'Pimple\Tests\Fixtures\Service', $serviceTwo);
221 $this->assertSame($serviceOne, $serviceTwo);
222 $this->assertSame($serviceOne->value, $serviceTwo->value);
224 $pimple->extend(
'factory_service', $service);
225 $serviceOne = $pimple[
'factory_service'];
226 $this->assertInstanceOf(
'Pimple\Tests\Fixtures\Service', $serviceOne);
227 $serviceTwo = $pimple[
'factory_service'];
228 $this->assertInstanceOf(
'Pimple\Tests\Fixtures\Service', $serviceTwo);
229 $this->assertNotSame($serviceOne, $serviceTwo);
230 $this->assertNotSame($serviceOne->value, $serviceTwo->value);
◆ testExtendDoesNotLeakWithFactories()
Pimple\Tests\PimpleTest::testExtendDoesNotLeakWithFactories |
( |
| ) |
|
Definition at line 233 of file PimpleTest.php.
235 if (extension_loaded(
'pimple')) {
236 $this->markTestSkipped(
'Pimple extension does not support this test');
238 $pimple =
new Container();
240 $pimple[
'foo'] = $pimple->factory(
function () {
return; });
241 $pimple[
'foo'] = $pimple->extend(
'foo',
function ($foo, $pimple) {
return; });
242 unset($pimple[
'foo']);
244 $p = new \ReflectionProperty($pimple,
'values');
245 $p->setAccessible(
true);
246 $this->assertEmpty($p->getValue($pimple));
248 $p = new \ReflectionProperty($pimple,
'factories');
249 $p->setAccessible(
true);
250 $this->assertCount(0, $p->getValue($pimple));
◆ testExtendFailsForInvalidServiceDefinitions()
Pimple\Tests\PimpleTest::testExtendFailsForInvalidServiceDefinitions |
( |
|
$service | ) |
|
badServiceDefinitionProvider Extension service definition is not a Closure or invokable object.
Definition at line 329 of file PimpleTest.php.
331 $pimple =
new Container();
332 $pimple[
'foo'] =
function () {};
333 $pimple->extend(
'foo', $service);
◆ testExtendFailsForKeysNotContainingServiceDefinitions()
Pimple\Tests\PimpleTest::testExtendFailsForKeysNotContainingServiceDefinitions |
( |
|
$service | ) |
|
badServiceDefinitionProvider Identifier "foo" does not contain an object definition.
Definition at line 317 of file PimpleTest.php.
319 $pimple =
new Container();
320 $pimple[
'foo'] = $service;
321 $pimple->extend(
'foo',
function () {});
◆ testExtendingService()
Pimple\Tests\PimpleTest::testExtendingService |
( |
| ) |
|
Definition at line 409 of file PimpleTest.php.
411 $pimple =
new Container();
412 $pimple[
'foo'] =
function () {
415 $pimple[
'foo'] = $pimple->extend(
'foo',
function ($foo, $app) {
418 $pimple[
'foo'] = $pimple->extend(
'foo',
function ($foo, $app) {
421 $this->assertSame(
'foo.bar.baz', $pimple[
'foo']);
◆ testExtendingServiceAfterOtherServiceFreeze()
Pimple\Tests\PimpleTest::testExtendingServiceAfterOtherServiceFreeze |
( |
| ) |
|
Definition at line 424 of file PimpleTest.php.
426 $pimple =
new Container();
427 $pimple[
'foo'] =
function () {
430 $pimple[
'bar'] =
function () {
433 $foo = $pimple[
'foo'];
435 $pimple[
'bar'] = $pimple->extend(
'bar',
function ($bar, $app) {
438 $this->assertSame(
'bar.baz', $pimple[
'bar']);
◆ testExtendValidatesKeyIsPresent()
Pimple\Tests\PimpleTest::testExtendValidatesKeyIsPresent |
( |
| ) |
|
Identifier "foo" is not defined.
Definition at line 257 of file PimpleTest.php.
259 $pimple =
new Container();
260 $pimple->extend(
'foo',
function () {});
◆ testFactoryFailsForInvalidServiceDefinitions()
Pimple\Tests\PimpleTest::testFactoryFailsForInvalidServiceDefinitions |
( |
|
$service | ) |
|
badServiceDefinitionProvider Service definition is not a Closure or invokable object.
Definition at line 295 of file PimpleTest.php.
297 $pimple =
new Container();
298 $pimple->factory($service);
◆ testFluentRegister()
Pimple\Tests\PimpleTest::testFluentRegister |
( |
| ) |
|
Definition at line 187 of file PimpleTest.php.
189 $pimple =
new Container();
190 $this->assertSame($pimple, $pimple->register($this->getMock(
'Pimple\ServiceProviderInterface')));
◆ testGlobalFunctionNameAsParameterValue()
Pimple\Tests\PimpleTest::testGlobalFunctionNameAsParameterValue |
( |
| ) |
|
Definition at line 166 of file PimpleTest.php.
168 $pimple =
new Container();
169 $pimple[
'global_function'] =
'strlen';
170 $this->assertSame(
'strlen', $pimple[
'global_function']);
◆ testIsset()
Pimple\Tests\PimpleTest::testIsset |
( |
| ) |
|
Definition at line 84 of file PimpleTest.php.
86 $pimple =
new Container();
87 $pimple[
'param'] =
'value';
88 $pimple[
'service'] =
function () {
89 return new Fixtures\Service();
92 $pimple[
'null'] = null;
94 $this->assertTrue(isset($pimple[
'param']));
95 $this->assertTrue(isset($pimple[
'service']));
96 $this->assertTrue(isset($pimple[
'null']));
97 $this->assertFalse(isset($pimple[
'non_existent']));
◆ testKeys()
Pimple\Tests\PimpleTest::testKeys |
( |
| ) |
|
Definition at line 263 of file PimpleTest.php.
265 $pimple =
new Container();
266 $pimple[
'foo'] = 123;
267 $pimple[
'bar'] = 123;
269 $this->assertEquals(array(
'foo',
'bar'), $pimple->keys());
◆ testOffsetGetHonorsNullValues()
Pimple\Tests\PimpleTest::testOffsetGetHonorsNullValues |
( |
| ) |
|
Definition at line 118 of file PimpleTest.php.
120 $pimple =
new Container();
121 $pimple[
'foo'] = null;
122 $this->assertNull($pimple[
'foo']);
◆ testOffsetGetValidatesKeyIsPresent()
Pimple\Tests\PimpleTest::testOffsetGetValidatesKeyIsPresent |
( |
| ) |
|
Identifier "foo" is not defined.
Definition at line 112 of file PimpleTest.php.
114 $pimple =
new Container();
◆ testOverridingServiceAfterFreeze()
Pimple\Tests\PimpleTest::testOverridingServiceAfterFreeze |
( |
| ) |
|
Cannot override frozen service "foo".
Definition at line 381 of file PimpleTest.php.
383 $pimple =
new Container();
384 $pimple[
'foo'] =
function () {
387 $foo = $pimple[
'foo'];
389 $pimple[
'foo'] =
function () {
◆ testProtect()
Pimple\Tests\PimpleTest::testProtect |
( |
|
$service | ) |
|
serviceDefinitionProvider
Definition at line 158 of file PimpleTest.php.
160 $pimple =
new Container();
161 $pimple[
'protected'] = $pimple->protect($service);
163 $this->assertSame($service, $pimple[
'protected']);
◆ testProtectFailsForInvalidServiceDefinitions()
Pimple\Tests\PimpleTest::testProtectFailsForInvalidServiceDefinitions |
( |
|
$service | ) |
|
badServiceDefinitionProvider Callable is not a Closure or invokable object.
Definition at line 306 of file PimpleTest.php.
308 $pimple =
new Container();
309 $pimple->protect($service);
◆ testRaw()
Pimple\Tests\PimpleTest::testRaw |
( |
| ) |
|
Definition at line 173 of file PimpleTest.php.
175 $pimple =
new Container();
176 $pimple[
'service'] = $definition = $pimple->factory(
function () {
return 'foo'; });
177 $this->assertSame($definition, $pimple->raw(
'service'));
◆ testRawHonorsNullValues()
Pimple\Tests\PimpleTest::testRawHonorsNullValues |
( |
| ) |
|
Definition at line 180 of file PimpleTest.php.
182 $pimple =
new Container();
183 $pimple[
'foo'] = null;
184 $this->assertNull($pimple->raw(
'foo'));
◆ testRawValidatesKeyIsPresent()
Pimple\Tests\PimpleTest::testRawValidatesKeyIsPresent |
( |
| ) |
|
Identifier "foo" is not defined.
Definition at line 197 of file PimpleTest.php.
199 $pimple =
new Container();
◆ testRemovingServiceAfterFreeze()
Pimple\Tests\PimpleTest::testRemovingServiceAfterFreeze |
( |
| ) |
|
Definition at line 394 of file PimpleTest.php.
396 $pimple =
new Container();
397 $pimple[
'foo'] =
function () {
400 $foo = $pimple[
'foo'];
402 unset($pimple[
'foo']);
403 $pimple[
'foo'] =
function () {
406 $this->assertSame(
'bar', $pimple[
'foo']);
◆ testServicesShouldBeDifferent()
Pimple\Tests\PimpleTest::testServicesShouldBeDifferent |
( |
| ) |
|
Definition at line 54 of file PimpleTest.php.
56 $pimple =
new Container();
57 $pimple[
'service'] = $pimple->factory(
function () {
58 return new Fixtures\Service();
61 $serviceOne = $pimple[
'service'];
62 $this->assertInstanceOf(
'Pimple\Tests\Fixtures\Service', $serviceOne);
64 $serviceTwo = $pimple[
'service'];
65 $this->assertInstanceOf(
'Pimple\Tests\Fixtures\Service', $serviceTwo);
67 $this->assertNotSame($serviceOne, $serviceTwo);
◆ testShare()
Pimple\Tests\PimpleTest::testShare |
( |
|
$service | ) |
|
serviceDefinitionProvider
Definition at line 141 of file PimpleTest.php.
143 $pimple =
new Container();
144 $pimple[
'shared_service'] = $service;
146 $serviceOne = $pimple[
'shared_service'];
147 $this->assertInstanceOf(
'Pimple\Tests\Fixtures\Service', $serviceOne);
149 $serviceTwo = $pimple[
'shared_service'];
150 $this->assertInstanceOf(
'Pimple\Tests\Fixtures\Service', $serviceTwo);
152 $this->assertSame($serviceOne, $serviceTwo);
◆ testShouldPassContainerAsParameter()
Pimple\Tests\PimpleTest::testShouldPassContainerAsParameter |
( |
| ) |
|
Definition at line 70 of file PimpleTest.php.
References $container.
72 $pimple =
new Container();
73 $pimple[
'service'] =
function () {
74 return new Fixtures\Service();
80 $this->assertNotSame($pimple, $pimple[
'service']);
81 $this->assertSame($pimple, $pimple[
'container']);
◆ testUnset()
Pimple\Tests\PimpleTest::testUnset |
( |
| ) |
|
Definition at line 125 of file PimpleTest.php.
127 $pimple =
new Container();
128 $pimple[
'param'] =
'value';
129 $pimple[
'service'] =
function () {
130 return new Fixtures\Service();
133 unset($pimple[
'param'], $pimple[
'service']);
134 $this->assertFalse(isset($pimple[
'param']));
135 $this->assertFalse(isset($pimple[
'service']));
◆ testWithClosure()
Pimple\Tests\PimpleTest::testWithClosure |
( |
| ) |
|
Definition at line 44 of file PimpleTest.php.
46 $pimple =
new Container();
47 $pimple[
'service'] =
function () {
48 return new Fixtures\Service();
51 $this->assertInstanceOf(
'Pimple\Tests\Fixtures\Service', $pimple[
'service']);
◆ testWithString()
Pimple\Tests\PimpleTest::testWithString |
( |
| ) |
|
Definition at line 36 of file PimpleTest.php.
38 $pimple =
new Container();
39 $pimple[
'param'] =
'value';
41 $this->assertEquals(
'value', $pimple[
'param']);
The documentation for this class was generated from the following file: