eZ\Bundle\EzPublishCoreBundle\Tests\Imagine\BinaryLoaderTest::testFind PHP Method

testFind() public method

public testFind ( )
    public function testFind()
    {
        $path = 'something.jpg';
        $mimeType = 'foo/mime-type';
        $content = 'some content';
        $binaryFile = new BinaryFile(array('id' => $path));
        $this->ioService->expects($this->once())->method('loadBinaryFile')->with($path)->will($this->returnValue($binaryFile));
        $format = 'jpg';
        $this->extensionGuesser->expects($this->once())->method('guess')->with($mimeType)->will($this->returnValue($format));
        $this->ioService->expects($this->once())->method('getFileContents')->with($binaryFile)->will($this->returnValue($content));
        $this->ioService->expects($this->once())->method('getMimeType')->with($binaryFile->id)->will($this->returnValue($mimeType));
        $expected = new Binary($content, $mimeType, $format);
        $this->assertEquals($expected, $this->binaryLoader->find($path));
    }