47c62abd0d99894522f1391cc768f283232c608b
[yaffs-website] / vendor / symfony / http-kernel / Tests / DependencyInjection / ServicesResetterTest.php
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
12 namespace Symfony\Component\HttpKernel\Tests\DependencyInjection;
13
14 use PHPUnit\Framework\TestCase;
15 use Symfony\Component\HttpKernel\DependencyInjection\ServicesResetter;
16 use Symfony\Component\HttpKernel\Tests\Fixtures\ClearableService;
17 use Symfony\Component\HttpKernel\Tests\Fixtures\ResettableService;
18
19 class ServicesResetterTest extends TestCase
20 {
21     protected function setUp()
22     {
23         ResettableService::$counter = 0;
24         ClearableService::$counter = 0;
25     }
26
27     public function testResetServices()
28     {
29         $resetter = new ServicesResetter(new \ArrayIterator(array(
30             'id1' => new ResettableService(),
31             'id2' => new ClearableService(),
32         )), array(
33             'id1' => 'reset',
34             'id2' => 'clear',
35         ));
36
37         $resetter->reset();
38
39         $this->assertEquals(1, ResettableService::$counter);
40         $this->assertEquals(1, ClearableService::$counter);
41     }
42 }