summaryrefslogtreecommitdiff
path: root/vendor/symfony/service-contracts/Test
diff options
context:
space:
mode:
authorpolo <ordipolo@gmx.fr>2026-10-18 00:08:23 +0200
committerpolo <ordipolo@gmx.fr>2026-10-18 00:10:03 +0200
commit05e38eadbeb3de19e5b26003c2b401e00bb71df4 (patch)
treecf48350b69cfce92de6f3a0e03eb0876931c7077 /vendor/symfony/service-contracts/Test
parent32843e50aa981f190bdb4fbc9adbeacc06fdf775 (diff)
downloadAppliGestionPHP-05e38eadbeb3de19e5b26003c2b401e00bb71df4.tar.gz
AppliGestionPHP-05e38eadbeb3de19e5b26003c2b401e00bb71df4.tar.bz2
AppliGestionPHP-05e38eadbeb3de19e5b26003c2b401e00bb71df4.zip
sortie de vendor du dépôt, oubli dans config-template.ini
Diffstat (limited to 'vendor/symfony/service-contracts/Test')
-rw-r--r--vendor/symfony/service-contracts/Test/ServiceLocatorTest.php23
-rw-r--r--vendor/symfony/service-contracts/Test/ServiceLocatorTestCase.php96
2 files changed, 0 insertions, 119 deletions
diff --git a/vendor/symfony/service-contracts/Test/ServiceLocatorTest.php b/vendor/symfony/service-contracts/Test/ServiceLocatorTest.php
deleted file mode 100644
index 07d12b4..0000000
--- a/vendor/symfony/service-contracts/Test/ServiceLocatorTest.php
+++ /dev/null
@@ -1,23 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Contracts\Service\Test;
13
14class_alias(ServiceLocatorTestCase::class, ServiceLocatorTest::class);
15
16if (false) {
17 /**
18 * @deprecated since PHPUnit 9.6
19 */
20 class ServiceLocatorTest
21 {
22 }
23}
diff --git a/vendor/symfony/service-contracts/Test/ServiceLocatorTestCase.php b/vendor/symfony/service-contracts/Test/ServiceLocatorTestCase.php
deleted file mode 100644
index 65a3fe3..0000000
--- a/vendor/symfony/service-contracts/Test/ServiceLocatorTestCase.php
+++ /dev/null
@@ -1,96 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Contracts\Service\Test;
13
14use PHPUnit\Framework\TestCase;
15use Psr\Container\ContainerExceptionInterface;
16use Psr\Container\ContainerInterface;
17use Psr\Container\NotFoundExceptionInterface;
18use Symfony\Contracts\Service\ServiceLocatorTrait;
19
20abstract class ServiceLocatorTestCase extends TestCase
21{
22 protected function getServiceLocator(array $factories): ContainerInterface
23 {
24 return new class($factories) implements ContainerInterface {
25 use ServiceLocatorTrait;
26 };
27 }
28
29 public function testHas()
30 {
31 $locator = $this->getServiceLocator([
32 'foo' => fn () => 'bar',
33 'bar' => fn () => 'baz',
34 fn () => 'dummy',
35 ]);
36
37 $this->assertTrue($locator->has('foo'));
38 $this->assertTrue($locator->has('bar'));
39 $this->assertFalse($locator->has('dummy'));
40 }
41
42 public function testGet()
43 {
44 $locator = $this->getServiceLocator([
45 'foo' => fn () => 'bar',
46 'bar' => fn () => 'baz',
47 ]);
48
49 $this->assertSame('bar', $locator->get('foo'));
50 $this->assertSame('baz', $locator->get('bar'));
51 }
52
53 public function testGetDoesNotMemoize()
54 {
55 $i = 0;
56 $locator = $this->getServiceLocator([
57 'foo' => function () use (&$i) {
58 ++$i;
59
60 return 'bar';
61 },
62 ]);
63
64 $this->assertSame('bar', $locator->get('foo'));
65 $this->assertSame('bar', $locator->get('foo'));
66 $this->assertSame(2, $i);
67 }
68
69 public function testThrowsOnUndefinedInternalService()
70 {
71 $locator = $this->getServiceLocator([
72 'foo' => function () use (&$locator) { return $locator->get('bar'); },
73 ]);
74
75 if (!$this->getExpectedException()) {
76 $this->expectException(NotFoundExceptionInterface::class);
77 $this->expectExceptionMessage('The service "foo" has a dependency on a non-existent service "bar". This locator only knows about the "foo" service.');
78 }
79
80 $locator->get('foo');
81 }
82
83 public function testThrowsOnCircularReference()
84 {
85 $locator = $this->getServiceLocator([
86 'foo' => function () use (&$locator) { return $locator->get('bar'); },
87 'bar' => function () use (&$locator) { return $locator->get('baz'); },
88 'baz' => function () use (&$locator) { return $locator->get('bar'); },
89 ]);
90
91 $this->expectException(ContainerExceptionInterface::class);
92 $this->expectExceptionMessage('Circular reference detected for service "bar", path: "bar -> baz -> bar".');
93
94 $locator->get('foo');
95 }
96}