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