mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-23 18:03:17 +00:00
PHRAS-1304_AUTO-COMPLETION_MASTER (#2061)
* PHRAS-1304_AUTO-COMPLETION_MASTER ported from 4.0 * PHRAS-1304_AUTO-COMPLETION_MASTER fix * PHRAS-1304_AUTO-COMPLETION_MASTER fix * PHRAS-1304_AUTO-COMPLETION_MASTER bump php version to 5.5.31 (5.5.21 is obsolete in cicleci) * PHRAS-1304_AUTO-COMPLETION_MASTER bump php version to 5.5.31 : php.ini moved in circelci * PHRAS-1304_AUTO-COMPLETION_MASTER add zmq & date to php for circleci * PHRAS-1304_AUTO-COMPLETION_MASTER add zmq * PHRAS-1304_AUTO-COMPLETION_MASTER bump amqp * PHRAS-1304_AUTO-COMPLETION_MASTER downgrade amqp to 1.2 to test compilation against old librabbit 0.4 (ubuntu) * PHRAS-1304_AUTO-COMPLETION_MASTER add amqp.so to php.ini, (re)bump amqp to 1.6 * PHRAS-1304_AUTO-COMPLETION_MASTER build rabittmq from git * PHRAS-1304_AUTO-COMPLETION_MASTER build rabittmq from git again * PHRAS-1304_AUTO-COMPLETION_MASTER build rabittmq from git again and again * PHRAS-1304_AUTO-COMPLETION_MASTER fix test on media rotation 600*400 -> 400*599 !!! * PHRAS-1304_AUTO-COMPLETION_MASTER restore facebook sdk to 4.0.1 due to mistake * PHRAS-1304_AUTO-COMPLETION_MASTER deleted unwanted file
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace Alchemy\Tests\Phrasea\SearchEngine;
|
||||
|
||||
use Alchemy\Phrasea\Application;
|
||||
use Alchemy\Phrasea\Collection\Reference\CollectionReference;
|
||||
use Alchemy\Phrasea\SearchEngine\SearchEngineOptions;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
@@ -20,14 +21,13 @@ class SearchEngineOptionsTest extends \PhraseanetTestCase
|
||||
/** @var Application $app */
|
||||
$app = self::$DI['app'];
|
||||
/** @var \collection $collection */
|
||||
$collection = self::$DI['collection'];
|
||||
$collections[$collection->get_base_id()] = $collection;
|
||||
$collection = $this->getCollection();
|
||||
|
||||
$options = new SearchEngineOptions($app);
|
||||
$options->onCollections($collections);
|
||||
$options->onBasesIds([$collection->get_base_id()]);
|
||||
$options->setRecordType(SearchEngineOptions::TYPE_ALL);
|
||||
$options->setSearchType(SearchEngineOptions::RECORD_RECORD);
|
||||
$options->allowBusinessFieldsOn($collections);
|
||||
$options->allowBusinessFieldsOn([$collection->get_base_id()]);
|
||||
|
||||
foreach ($collection->get_databox()->get_meta_structure() as $field) {
|
||||
$options->setFields([$field]);
|
||||
@@ -57,6 +57,9 @@ class SearchEngineOptionsTest extends \PhraseanetTestCase
|
||||
$app = self::$DI['app'];
|
||||
$this->authenticate($app);
|
||||
|
||||
/** @var \collection $collection */
|
||||
$collection = self::$DI['collection'];
|
||||
$sbid = $collection->get_sbas_id();
|
||||
foreach ($this->provideRequestData() as $pack) {
|
||||
list ($query, $request, $field, $dateField) = $pack;
|
||||
|
||||
@@ -65,9 +68,12 @@ class SearchEngineOptionsTest extends \PhraseanetTestCase
|
||||
$options = SearchEngineOptions::fromRequest($app, $httpRequest);
|
||||
|
||||
// Check done this way because returned array can be indexed differently
|
||||
$collections = $options->getCollections();
|
||||
$this->assertCount(1, $collections);
|
||||
$this->assertContains(self::$DI['collection'], $collections);
|
||||
$collectionsReferences = $options->getCollectionsReferencesByDatabox();
|
||||
$this->assertCount(1, $collectionsReferences);
|
||||
$this->assertCount(1, $collectionsReferences[$sbid]);
|
||||
/** @var CollectionReference $collRef */
|
||||
$collRef = $collectionsReferences[$sbid][0];
|
||||
$this->assertEquals($collection->get_base_id(), $collRef->getBaseId());
|
||||
$this->assertEquals([$field], $options->getFields());
|
||||
$this->assertEquals('video', $options->getRecordType());
|
||||
$this->assertEquals('1', $options->getSearchType());
|
||||
@@ -99,7 +105,7 @@ class SearchEngineOptionsTest extends \PhraseanetTestCase
|
||||
|
||||
$options = SearchEngineOptions::fromRequest(self::$DI['app'], $httpRequest);
|
||||
|
||||
$this->assertEquals([], $options->getCollections());
|
||||
$this->assertEquals([], $options->getCollectionsReferencesByDatabox());
|
||||
$this->assertEquals([], $options->getFields());
|
||||
$this->assertEquals('video', $options->getRecordType());
|
||||
$this->assertEquals('1', $options->getSearchType());
|
||||
@@ -119,7 +125,7 @@ class SearchEngineOptionsTest extends \PhraseanetTestCase
|
||||
{
|
||||
$options = SearchEngineOptions::fromRequest(self::$DI['app'], new Request());
|
||||
|
||||
$this->assertEquals([], $options->getCollections());
|
||||
$this->assertEquals([], $options->getCollectionsReferencesByDatabox());
|
||||
$this->assertEquals([], $options->getFields());
|
||||
$this->assertEquals(null, $options->getRecordType());
|
||||
$this->assertEquals('0', $options->getSearchType());
|
||||
|
@@ -33,7 +33,7 @@ class LimitedStructureTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$wrapped = $this->prophesize(Structure::class);
|
||||
$options = $this->prophesize(SearchEngineOptions::class);
|
||||
$options->getBusinessFieldsOn()->willReturn([$this->getCollectionStub(2)]);
|
||||
$options->getBusinessFieldsOn()->willReturn([2]);
|
||||
$structure = new LimitedStructure($wrapped->reveal(), $options->reveal());
|
||||
|
||||
$wrapped->get('foo')
|
||||
@@ -58,10 +58,7 @@ class LimitedStructureTest extends \PHPUnit_Framework_TestCase
|
||||
public function testGetAllFields()
|
||||
{
|
||||
$options = $this->prophesize(SearchEngineOptions::class);
|
||||
$options->getBusinessFieldsOn()->willReturn([
|
||||
$this->getCollectionStub(1),
|
||||
$this->getCollectionStub(3)
|
||||
]);
|
||||
$options->getBusinessFieldsOn()->willReturn([1, 3]);
|
||||
$wrapped = $this->prophesize(Structure::class);
|
||||
$structure = new LimitedStructure($wrapped->reveal(), $options->reveal());
|
||||
|
||||
|
Reference in New Issue
Block a user