mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 15:33:15 +00:00
Fix public API BC break
This commit is contained in:
@@ -39,7 +39,7 @@ final class GlobalStructure implements Structure
|
|||||||
return new self($fields, $flags);
|
return new self($fields, $flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __construct(array $fields, array $flags)
|
public function __construct(array $fields = [], array $flags = [])
|
||||||
{
|
{
|
||||||
Assertion::allIsInstanceOf($fields, Field::class);
|
Assertion::allIsInstanceOf($fields, Field::class);
|
||||||
Assertion::allIsInstanceOf($flags, Flag::class);
|
Assertion::allIsInstanceOf($flags, Flag::class);
|
||||||
@@ -51,7 +51,7 @@ final class GlobalStructure implements Structure
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function add(Field $field)
|
public function add(Field $field)
|
||||||
{
|
{
|
||||||
$name = $field->getName();
|
$name = $field->getName();
|
||||||
if (isset($this->fields[$name])) {
|
if (isset($this->fields[$name])) {
|
||||||
|
@@ -4,6 +4,7 @@ namespace Alchemy\Tests\Phrasea\SearchEngine\AST;
|
|||||||
|
|
||||||
use Alchemy\Phrasea\SearchEngine\Elastic\AST\FlagStatement;
|
use Alchemy\Phrasea\SearchEngine\Elastic\AST\FlagStatement;
|
||||||
use Alchemy\Phrasea\SearchEngine\Elastic\Search\QueryContext;
|
use Alchemy\Phrasea\SearchEngine\Elastic\Search\QueryContext;
|
||||||
|
use Alchemy\Phrasea\SearchEngine\Elastic\Structure\Flag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @group unit
|
* @group unit
|
||||||
@@ -24,13 +25,14 @@ class FlagStatementTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testQueryBuild()
|
public function testQueryBuild()
|
||||||
{
|
{
|
||||||
$query_context = $this->prophesize(QueryContext::class);
|
$query_context = $this->prophesize(QueryContext::class);
|
||||||
|
$query_context->getFlag('foo')->willReturn(new Flag('bar'));
|
||||||
|
|
||||||
$node = new FlagStatement('foo', true);
|
$node = new FlagStatement('foo', true);
|
||||||
$query = $node->buildQuery($query_context->reveal());
|
$query = $node->buildQuery($query_context->reveal());
|
||||||
|
|
||||||
$expected = '{
|
$expected = '{
|
||||||
"term": {
|
"term": {
|
||||||
"flags.foo": true
|
"flags.bar": true
|
||||||
}
|
}
|
||||||
}';
|
}';
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user