Esempio n. 1
0
 private function checkResultEntries(AbstractEntity $entity, $expectedCount, $expectedResultClass, $expectedEntryType, array $criteria = null, callable $countFunction = null)
 {
     $result = $entity->find($criteria);
     $this->assertNotEmpty($result);
     $this->assertInstanceOf($expectedResultClass, $result, get_class($result));
     if ($countFunction === null) {
         $countFunction = 'count';
     }
     $this->assertEquals($expectedCount, $countFunction($result));
     $classType = class_exists($expectedEntryType);
     foreach ($result as $entry) {
         if ($classType) {
             $this->assertInstanceOf($expectedEntryType, $entry, get_class($entry));
         } else {
             $this->assertInternalType($expectedEntryType, $entry, gettype($entry));
         }
     }
 }