Files
Phraseanet/tests/Alchemy/Tests/Phrasea/Controller/Utils/PathFileTestTest.php
Romain Neutron d7f7e1c92c Fix CS
2014-01-14 12:04:38 +01:00

38 lines
1.5 KiB
PHP

<?php
namespace Alchemy\Tests\Phrasea\Controller\Utils;
class PathFileTestTest extends \PhraseanetWebTestCase
{
/**
* Default route test
*/
public function testRoutePath()
{
$file = new \SplFileObject(__DIR__ . '/../../../../../files/cestlafete.jpg');
self::$DI['client']->request("GET", "/admin/tests/pathurl/path/", ['path' => $file->getPathname()]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
$this->assertEquals("application/json", self::$DI['client']->getResponse()->headers->get("content-type"));
$content = json_decode(self::$DI['client']->getResponse()->getContent());
$this->assertTrue(is_object($content));
$this->assertObjectHasAttribute('exists', $content);
$this->assertObjectHasAttribute('file', $content);
$this->assertObjectHasAttribute('dir', $content);
$this->assertObjectHasAttribute('readable', $content);
$this->assertObjectHasAttribute('executable', $content);
}
public function testRouteUrl()
{
self::$DI['client']->request("GET", "/admin/tests/pathurl/url/", ['url' => "www.google.com"]);
$response = self::$DI['client']->getResponse();
$this->assertTrue($response->isOk());
$this->assertEquals("application/json", self::$DI['client']->getResponse()->headers->get("content-type"));
$content = json_decode(self::$DI['client']->getResponse()->getContent());
$this->assertTrue(is_object($content));
}
}