Fix & enhance unit tests

This commit is contained in:
Nicolas Le Goff
2013-08-08 16:20:16 +02:00
committed by Romain Neutron
parent 5fbb2e83b2
commit 18b79e6f1a
2 changed files with 14 additions and 1 deletions

View File

@@ -442,12 +442,22 @@ class LazaretTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$em->expects($this->once())
->method('flush');
$called = false;
$phpunit = $this;
self::$DI['app']['phraseanet.logger'] = self::$DI['app']->protect(function () use (&$called, $phpunit) {
$called = true;
return $phpunit->getMockBuilder('\Session_Logger')
->disableOriginalConstructor()
->getMock();
});
self::$DI['app']['EM'] = $em;
self::$DI['client'] = new Client(self::$DI['app'], array());
self::$DI['client']->request('POST', '/prod/lazaret/' . $id . '/accept/', array(
'record_id' => self::$DI['record_1']->get_record_id()
));
$this->assertTrue($called);
$response = self::$DI['client']->getResponse();

View File

@@ -4,6 +4,7 @@ namespace Alchemy\Tests\Phrasea\Controller\Prod;
use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Border\Manager;
use DataURI;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\HttpFoundation\Response;
@@ -76,8 +77,10 @@ class UploadTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
->disableOriginalConstructor()
->getMock();
$data = DataUri\Data::buildFromFile(__DIR__ . '/../../../../../files/cestlafete.jpg');
$params = array(
'base_id' => self::$DI['collection']->get_base_id()
'base_id' => self::$DI['collection']->get_base_id(),
'b64_image' => DataUri\Dumper::dump($data)
);
$files = array(