@@ 22-43 (lines=22) @@ | ||
19 | return $directory = __DIR__ . '/../'; |
|
20 | } |
|
21 | ||
22 | public function testItCanFindTheClassWhenPresent() |
|
23 | { |
|
24 | // Mock the FileLocator to return the mock of the repository |
|
25 | $fileLocator = $this->getMockBuilder(FileLocator::class) |
|
26 | ->disableOriginalConstructor() |
|
27 | ->getMock(); |
|
28 | ||
29 | $fileLocator->expects($this->any()) |
|
30 | ->method('locate') |
|
31 | ->will($this->returnValue($this->getBundleDirectory())); |
|
32 | ||
33 | $bundles = [ |
|
34 | 'ResponsiveImageBundle' => 'IrishDan\ResponsiveImageBundle\ResponsiveImageBundle', |
|
35 | 'TwigBundle' => "Symfony\Bundle\TwigBundle\TwigBundle", |
|
36 | ]; |
|
37 | ||
38 | $locator = new ImageEntityClassLocator($bundles, $fileLocator); |
|
39 | ||
40 | $locator->setEntityDirectory('Tests/Entity'); |
|
41 | ||
42 | $this->assertEquals('IrishDan\ResponsiveImageBundle\Tests\Entity\TestImage', $locator->getClassName()); |
|
43 | } |
|
44 | ||
45 | public function testItCantFindTheClassWhenNotPresent() |
|
46 | { |
|
@@ 45-65 (lines=21) @@ | ||
42 | $this->assertEquals('IrishDan\ResponsiveImageBundle\Tests\Entity\TestImage', $locator->getClassName()); |
|
43 | } |
|
44 | ||
45 | public function testItCantFindTheClassWhenNotPresent() |
|
46 | { |
|
47 | // Mock the EntityManager to return the mock of the repository |
|
48 | $fileLocator = $this->getMockBuilder(FileLocator::class) |
|
49 | ->disableOriginalConstructor() |
|
50 | ->getMock(); |
|
51 | ||
52 | ||
53 | $fileLocator->expects($this->any()) |
|
54 | ->method('locate') |
|
55 | ->will($this->returnValue($this->getBundleDirectory())); |
|
56 | ||
57 | $bundles = [ |
|
58 | 'ResponsiveImageBundle' => 'IrishDan\ResponsiveImageBundle\ResponsiveImageBundle', |
|
59 | 'TwigBundle' => 'Symfony\Bundle\TwigBundle\TwigBundle', |
|
60 | ]; |
|
61 | ||
62 | $locator = new ImageEntityClassLocator($bundles, $fileLocator); |
|
63 | ||
64 | $this->assertNull($locator->getClassName()); |
|
65 | } |
|
66 | } |
|
67 |