Fix unit tests when running without phrasea2 extension

This commit is contained in:
Romain Neutron
2014-03-03 19:26:44 +01:00
parent 01a4b97f7a
commit 4695054dcf
28 changed files with 136 additions and 9 deletions

View File

@@ -40,6 +40,7 @@ class Sha256Test extends \PhraseanetTestCase
{
$session = self::$DI['app']['EM']->find('Phraseanet:LazaretSession', 1);
self::$DI['app']['phraseanet.SE'] = $this->createSearchEngineMock();
self::$DI['app']['border-manager']->process($session, File::buildFromPathfile($this->media->getFile()->getPathname(), self::$DI['collection'], self::$DI['app']), null, Manager::FORCE_RECORD);
$mock = $this->getMock('\\Alchemy\\Phrasea\\Border\\File', ['getSha256'], [self::$DI['app'], $this->media, self::$DI['collection']]);

View File

@@ -79,6 +79,7 @@ class ManagerTest extends \PhraseanetAuthenticatedWebTestCase
$records[] = $record;
};
self::$DI['app']['phraseanet.SE'] = $this->createSearchEngineMock();
$this->assertEquals(Manager::RECORD_CREATED, $this->object->process($this->session, File::buildFromPathfile(self::$file1, self::$DI['collection'], self::$DI['app']), $postProcessRecord));
$shaChecker = new Sha256(self::$DI['app']);
$this->object->registerChecker($shaChecker);
@@ -118,6 +119,7 @@ class ManagerTest extends \PhraseanetAuthenticatedWebTestCase
$postProcessRecord = function ($record) use (&$records) {
$records[] = $record;
};
self::$DI['app']['phraseanet.SE'] = $this->createSearchEngineMock();
$this->assertEquals(Manager::LAZARET_CREATED, $this->object->process($this->session, File::buildFromPathfile(self::$file1, self::$DI['collection'], self::$DI['app']), NULL, Manager::FORCE_LAZARET));
$this->assertEquals(Manager::RECORD_CREATED, $this->object->process($this->session, File::buildFromPathfile(self::$file1, self::$DI['collection'], self::$DI['app']), $postProcessRecord));
@@ -202,6 +204,7 @@ class ManagerTest extends \PhraseanetAuthenticatedWebTestCase
$file->addAttribute(new Status(self::$DI['app'], strrev($status)));
self::$DI['app']['phraseanet.SE'] = $this->createSearchEngineMock();
$this->assertEquals(Manager::RECORD_CREATED, $this->object->process($this->session, $file, $postProcessRecord, Manager::FORCE_RECORD));
$record = current($records);
@@ -552,6 +555,7 @@ class ManagerTest extends \PhraseanetAuthenticatedWebTestCase
$records[] = $record;
};
self::$DI['app']['phraseanet.SE'] = $this->createSearchEngineMock();
$visa = $this->object->getVisa(File::buildFromPathfile(self::$file1, self::$DI['collection'], self::$DI['app']));
$this->assertInstanceOf('\\Alchemy\\Phrasea\\Border\\Visa', $visa);