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