public function testIfWillFindAllByCriteria() { $model = new WithBaseAttributes(); $model->string = 'foo'; $em = new EntityManager($model); $model = new WithBaseAttributes(); $model->string = 'foo'; $em->insert($model); $model = new WithBaseAttributes(); $model->string = 'foo'; $em->insert($model); $model = new WithBaseAttributes(); $model->string = 'foo'; $em->insert($model); $model = new WithBaseAttributes(); $model->string = 'blah'; $em->insert($model); $model = new WithBaseAttributes(); $model->string = 'blah'; $em->insert($model); $model = new WithBaseAttributes(); $model->string = 'blah'; $em->insert($model); $finder = new Finder($model); $criteria = new Criteria(); $criteria->string = 'foo'; $all = $finder->findAll($criteria); $this->assertSame(6, $finder->count()); $this->assertSame(3, count($all)); foreach ($all as $found) { $this->assertInstanceof(WithBaseAttributes::class, $found); $this->assertSame('foo', $found->string); } }
/** * Fetches the data from the persistent data storage. * @return Document[]|Cursor list of data items * @since v1.0 */ protected function fetchData() { $criteria = $this->configureFetch(); // Finally apply all to finder return $this->finder->findAll($criteria); }