Esempio n. 1
0
 /**
  * Tests finding objects by various queries.
  *
  * @param array $criteria Search criteria.
  * @param array $params   Search params.
  * @param array $expected Expected results.
  *
  * @depends      testInsert
  * @dataProvider provideFindCriteria
  */
 public function testFind(array $criteria, array $params, array $expected)
 {
     $this->insertData();
     $hobbits = $this->repository->find($criteria, $params);
     $this->assertCount(count($expected), $hobbits, $this->logger->getLastMessage());
     $this->assertEquals($expected, ObjectUtils::pluck($hobbits, 'name'), $this->logger->getLastMessage());
 }
Esempio n. 2
0
 /**
  * Tests finding by multiple id's.
  *
  * @depends testInsert
  */
 public function testFindByMultipleIds()
 {
     $hobbits = $this->repository->find();
     $otherHobbits = $this->repository->find(['id:in' => ObjectUtils::pluck($hobbits, 'id')]);
     $this->assertEquals($hobbits, $otherHobbits, $this->logger->getLastMessage());
 }