Basho\Tests\EncodedDataTest::testNoEncoding PHP Method

testNoEncoding() public method

Test storing and fetching an image as a base64 embedded HTML img tag so it can be accessed via the browser
public testNoEncoding ( )
    public function testNoEncoding()
    {
        $image = file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . static::TEST_IMG);
        $object = (new Riak\Object('<img src="data:image/png;base64,' . base64_encode($image) . '"/>'))->setContentEncoding("none")->setContentType("text/html");
        $storeCommand = (new Command\Builder\StoreObject(static::$riak))->withObject($object)->buildLocation(static::BASE64_KEY . '.png', static::BUCKET)->build();
        $response = $storeCommand->execute();
        $this->assertEquals('204', $response->getCode());
        $this->assertEquals(md5($object->getData()), md5($storeCommand->getEncodedData()));
        $fetchCommand = (new Command\Builder\FetchObject(static::$riak))->buildLocation(static::BASE64_KEY . '.png', static::BUCKET)->build();
        $response = $fetchCommand->execute();
        $this->assertEquals('200', $response->getCode());
        $this->assertInstanceOf('Basho\\Riak\\Object', $response->getObject());
        $this->assertEquals($object->getData(), $response->getObject()->getData());
    }