function it_finds_matching_nodes(FieldNode $f1, FieldNode $f2) { $criteria = ['search' => 'criteria']; $f1->matches($criteria)->willReturn(false); $f2->matches($criteria)->willReturn(true); $this->findMatching($criteria)->shouldBeLike(new FieldCollection([$f2->getWrappedObject()])); }
function it_does_not_match_if_any_criteria_fields_fail_to_match(FieldNode $f1, FieldNode $f2) { $f1->matches('search-value1')->willReturn(true); $f2->matches('search-value2')->willReturn(false); $this->matches(['field1' => 'search-value1', 'field2' => 'search-value2'])->shouldReturn(false); }
function it_does_not_match_if_resource_does_not_match(FieldNode $f1, ResourceNode $resource) { $f1->matches('search-value1')->willReturn(true); $resource->matches(['resource_field' => 'search-value2'])->willReturn(false); $this->matches(['field1' => 'search-value1', ['resource', 'resource1', ['resource_field' => 'search-value2']]])->shouldReturn(false); }