PHRAS-2831_port-truncation_4.1

fix tests
This commit is contained in:
Jean-Yves Gaulier
2019-11-19 17:34:27 +01:00
parent 3145049247
commit e09c176f3f
2 changed files with 15 additions and 1 deletions

View File

@@ -48,6 +48,7 @@ class TextNodeTest extends \PHPUnit_Framework_TestCase
$query_context->getUnrestrictedFields()->willReturn([$field]); $query_context->getUnrestrictedFields()->willReturn([$field]);
$query_context->getPrivateFields()->willReturn([]); $query_context->getPrivateFields()->willReturn([]);
$query_context->localizeField($field)->willReturn(['foo.fr', 'foo.en']); $query_context->localizeField($field)->willReturn(['foo.fr', 'foo.en']);
$query_context->truncationField($field)->willReturn([]);
$node = new TextNode('bar', new Context('baz')); $node = new TextNode('bar', new Context('baz'));
$query = $node->buildQuery($query_context->reveal()); $query = $node->buildQuery($query_context->reveal());
@@ -80,12 +81,18 @@ class TextNodeTest extends \PHPUnit_Framework_TestCase
$query_context $query_context
->localizeField($public_field) ->localizeField($public_field)
->willReturn(['foo.fr', 'foo.en']); ->willReturn(['foo.fr', 'foo.en']);
$query_context
->truncationField($public_field)
->willReturn([]);
$query_context $query_context
->getPrivateFields() ->getPrivateFields()
->willReturn([$private_field]); ->willReturn([$private_field]);
$query_context $query_context
->localizeField($private_field) ->localizeField($private_field)
->willReturn(['private_caption.bar.fr', 'private_caption.bar.en']); ->willReturn(['private_caption.bar.fr', 'private_caption.bar.en']);
$query_context
->truncationField($private_field)
->willReturn([]);
$node = new TextNode('baz'); $node = new TextNode('baz');
$query = $node->buildQuery($query_context->reveal()); $query = $node->buildQuery($query_context->reveal());
@@ -136,6 +143,7 @@ class TextNodeTest extends \PHPUnit_Framework_TestCase
$query_context->getUnrestrictedFields()->willReturn([$field]); $query_context->getUnrestrictedFields()->willReturn([$field]);
$query_context->getPrivateFields()->willReturn([]); $query_context->getPrivateFields()->willReturn([]);
$query_context->localizeField($field)->willReturn(['foo.fr', 'foo.en']); $query_context->localizeField($field)->willReturn(['foo.fr', 'foo.en']);
$query_context->truncationField($field)->willReturn([]);
$node = new TextNode('bar'); $node = new TextNode('bar');
$node->setConcepts([ $node->setConcepts([
@@ -180,12 +188,18 @@ class TextNodeTest extends \PHPUnit_Framework_TestCase
$query_context $query_context
->localizeField($public_field) ->localizeField($public_field)
->willReturn(['foo.fr', 'foo.en']); ->willReturn(['foo.fr', 'foo.en']);
$query_context
->truncationField($public_field)
->willReturn([]);
$query_context $query_context
->getPrivateFields() ->getPrivateFields()
->willReturn([$private_field]); ->willReturn([$private_field]);
$query_context $query_context
->localizeField($private_field) ->localizeField($private_field)
->willReturn(['private_caption.bar.fr', 'private_caption.bar.en']); ->willReturn(['private_caption.bar.fr', 'private_caption.bar.en']);
$query_context
->truncationField($private_field)
->willReturn([]);
$node = new TextNode('baz'); $node = new TextNode('baz');
$node->setConcepts([ $node->setConcepts([

View File

@@ -53,7 +53,7 @@ class QueryContextTest extends \PHPUnit_Framework_TestCase
$context = new QueryContext(null, $structure->reveal(), [], 'fr'); $context = new QueryContext(null, $structure->reveal(), [], 'fr');
$this->assertEquals([$foo_field, $bar_field], $context->getPrivateFields()); $this->assertEquals([$foo_field, $bar_field], $context->getPrivateFields());
$narrowed_context = new QueryContext($structure->reveal(), [], 'fr', ['foo']); $narrowed_context = new QueryContext(null, $structure->reveal(), [], 'fr', ['foo']);
$this->assertEquals([$foo_field], $narrowed_context->getPrivateFields()); $this->assertEquals([$foo_field], $narrowed_context->getPrivateFields());
} }
} }