Security update for Core, with self-updated composer
[yaffs-website] / vendor / symfony / validator / Tests / Mapping / Loader / FilesLoaderTest.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\Validator\Tests\Mapping\Loader;
13
14 use PHPUnit\Framework\TestCase;
15 use Symfony\Component\Validator\Mapping\ClassMetadata;
16 use Symfony\Component\Validator\Mapping\Loader\LoaderInterface;
17
18 class FilesLoaderTest extends TestCase
19 {
20     public function testCallsGetFileLoaderInstanceForeachPath()
21     {
22         $loader = $this->getFilesLoader($this->getFileLoader());
23         $this->assertEquals(4, $loader->getTimesCalled());
24     }
25
26     public function testCallsActualFileLoaderForMetadata()
27     {
28         $fileLoader = $this->getFileLoader();
29         $fileLoader->expects($this->exactly(4))
30             ->method('loadClassMetadata');
31         $loader = $this->getFilesLoader($fileLoader);
32         $loader->loadClassMetadata(new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity'));
33     }
34
35     public function getFilesLoader(LoaderInterface $loader)
36     {
37         return $this->getMockForAbstractClass('Symfony\Component\Validator\Tests\Fixtures\FilesLoader', array(array(
38             __DIR__.'/constraint-mapping.xml',
39             __DIR__.'/constraint-mapping.yaml',
40             __DIR__.'/constraint-mapping.test',
41             __DIR__.'/constraint-mapping.txt',
42         ), $loader));
43     }
44
45     public function getFileLoader()
46     {
47         return $this->getMockBuilder('Symfony\Component\Validator\Mapping\Loader\LoaderInterface')->getMock();
48     }
49 }