Пример #1
0
 public function testIfWillFindAllByAttributes()
 {
     $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);
     $all = $finder->findAllByAttributes(['string' => 'foo']);
     $this->assertSame(6, $finder->count());
     $this->assertSame(3, count($all));
     foreach ($all as $found) {
         $this->assertInstanceof(WithBaseAttributes::class, $found);
         $this->assertSame('foo', $found->string);
     }
 }