eZ\Bundle\EzPublishCoreBundle\Tests\Imagine\AliasGeneratorTest::testGetVariationAlreadyStored PHP Method

testGetVariationAlreadyStored() public method

    public function testGetVariationAlreadyStored()
    {
        $originalPath = 'foo/bar/image.jpg';
        $variationName = 'my_variation';
        $imageId = '123-45';
        $imageValue = new ImageValue(array('id' => $originalPath, 'imageId' => $imageId));
        $field = new Field(array('value' => $imageValue));
        $expectedUrl = "http://localhost/foo/bar/image_{$variationName}.jpg";
        $this->ioResolver->expects($this->once())->method('isStored')->with($originalPath, $variationName)->will($this->returnValue(true));
        $this->logger->expects($this->once())->method('debug');
        $this->dataLoader->expects($this->never())->method('find');
        $this->filterManager->expects($this->never())->method('applyFilter');
        $this->ioResolver->expects($this->never())->method('store');
        $this->ioResolver->expects($this->once())->method('resolve')->with($originalPath, $variationName)->will($this->returnValue($expectedUrl));
        $expected = new ImageVariation(array('name' => $variationName, 'fileName' => "image_{$variationName}.jpg", 'dirPath' => 'http://localhost/foo/bar', 'uri' => $expectedUrl, 'imageId' => $imageId));
        $this->assertEquals($expected, $this->aliasGenerator->getVariation($field, new VersionInfo(), $variationName));
    }