mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 06:53: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);
|
||||
}
|
||||
|
||||
public function __construct(array $fields, array $flags)
|
||||
public function __construct(array $fields = [], array $flags = [])
|
||||
{
|
||||
Assertion::allIsInstanceOf($fields, Field::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();
|
||||
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\Search\QueryContext;
|
||||
use Alchemy\Phrasea\SearchEngine\Elastic\Structure\Flag;
|
||||
|
||||
/**
|
||||
* @group unit
|
||||
@@ -24,13 +25,14 @@ class FlagStatementTest extends \PHPUnit_Framework_TestCase
|
||||
public function testQueryBuild()
|
||||
{
|
||||
$query_context = $this->prophesize(QueryContext::class);
|
||||
$query_context->getFlag('foo')->willReturn(new Flag('bar'));
|
||||
|
||||
$node = new FlagStatement('foo', true);
|
||||
$query = $node->buildQuery($query_context->reveal());
|
||||
|
||||
$expected = '{
|
||||
"term": {
|
||||
"flags.foo": true
|
||||
"flags.bar": true
|
||||
}
|
||||
}';
|
||||
|
||||
|
Reference in New Issue
Block a user