eZ\Publish\Core\IO\Tests\IOMetadataHandler\FlysystemTest::testCreate PHP Method

testCreate() public method

public testCreate ( )
    public function testCreate()
    {
        // good example of bad responsibilities... since create also loads, we test the same thing twice
        $spiCreateStruct = new SPIBinaryFileCreateStruct();
        $spiCreateStruct->id = 'prefix/my/file.png';
        $spiCreateStruct->size = 123;
        $spiCreateStruct->mtime = new DateTime('@1307155200');
        $expectedSpiBinaryFile = new SPIBinaryFile();
        $expectedSpiBinaryFile->id = 'prefix/my/file.png';
        $expectedSpiBinaryFile->size = 123;
        $expectedSpiBinaryFile->mtime = new DateTime('@1307155200');
        $this->filesystem->expects($this->once())->method('getMetadata')->with($spiCreateStruct->id)->will($this->returnValue(array('timestamp' => 1307155200, 'size' => 123)));
        $spiBinaryFile = $this->handler->create($spiCreateStruct);
        $this->assertInstanceOf('eZ\\Publish\\SPI\\IO\\BinaryFile', $spiBinaryFile);
        $this->assertEquals($expectedSpiBinaryFile, $spiBinaryFile);
    }