Exemplo n.º 1
0
 public function testGetEntity()
 {
     $dbConnMocked = Mockery::mock('PDO');
     $statement = Mockery::mock('\\PDOStatement');
     $dbConnMocked->shouldReceive('prepare')->with('SELECT * FROM users')->andReturn($statement);
     $dbConnMocked->shouldReceive('prepare')->with('SELECT * FROM jobs')->andReturn(false);
     $statement->shouldReceive('execute');
     $statement->shouldReceive('fetchAll')->with(PDO::FETCH_ASSOC);
     $this->assertJson(GetEntity::all('users', $dbConnMocked));
 }
Exemplo n.º 2
0
 /**
  * Fetch all record from the database 
  *
  * @return array
  */
 public static function all()
 {
     return GetEntity::all(self::getTableName());
 }