/**
  * @param array|string $where
  * @param array $params
  * @return static[]
  */
 public static function findAll($where = null, $params = null)
 {
     if (is_array($where)) {
         $rows = DbClient::findAllByColumns(static::getTableName(), $where);
     } elseif (is_string($where) || $where === null) {
         $rows = DbClient::findAll(self::completeSelectSql($where), $params);
     } else {
         $type = gettype($where);
         throw new InvalidArgumentException("Argument 'where' must be a string or an array, {$type} given.");
     }
     $result = [];
     foreach ($rows as $row) {
         $result[] = static::fromArray($row);
     }
     return $result;
 }
 public function testFindAllByColumns()
 {
     $this->mockEngineMethod('findAllByColumns')->with($this->equalTo('table'), $this->equalTo([]), $this->equalTo(['name']))->will($this->returnValue(true));
     $this->assertTrue(DbClient::findAllByColumns('table', [], ['name']));
 }