/** * @test */ public function addAndFilterTest() { $testEmail = 'my-mail-' . time() . '@test.com'; $dataInstance = new Document(array('email' => $testEmail, 'age' => 31, 'eyeColor' => 'green'), $this->fixture->getIdentifier()); $this->fixture->add($dataInstance); // First check if the Document instance was added $person = $this->fixture->findByIdentifier($testEmail); $this->assertNotNull($person); // Now really test the filter $filterResult = $this->fixture->filter(array(new PropertyComparison('email', ComparisonInterface::TYPE_EQUAL_TO, $testEmail))); $this->assertInstanceOf('Cundd\\PersistentObjectStore\\Filter\\FilterResult', $filterResult); $this->assertGreaterThan(0, $filterResult->count()); $person = $filterResult->current(); $this->assertNotNull($person); $this->assertSame(31, $person->valueForKeyPath('age')); $this->assertSame('green', $person->valueForKeyPath('eyeColor')); }