public function testUploadAction()
{
/**
* @var RouteCollection $routeCollection
*/
$client = $this->createClient();
$routeCollection = $this->get('router')->getRouteCollection();
$image = new UploadedFile(__DIR__ . '/images/image.png', 'image.png', 'image/png', 3966, null, true);
$client->request('POST', $routeCollection->get('elcodi.route.image_upload')->getPath(), [], ['file' => $image]);
$response = $client->getResponse();
$this->assertEquals(200, $response->getStatusCode());
$content = json_decode($response->getContent(), true);
$this->assertEquals('ok', $content['status']);
/**
* @var FileInterface $image
*/
$image = $this->find('image', 1);
$this->assertInstanceOf('Elcodi\\Component\\Media\\Entity\\Interfaces\\ImageInterface', $image);
$this->assertEmpty($image->getContent());
$this->get('elcodi.manager.media_file')->downloadFile($image);
$this->assertNotEmpty($image->getContent());
}