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)); }
/** * Fetch all record from the database * * @return array */ public static function all() { return GetEntity::all(self::getTableName()); }