/** * finds all entities in this repository * * @return array */ public function findAll() { $stmt = $this->database->getConnection()->prepare($this->createSelect()); return $this->buildEntities($stmt); }
public function testInit() { $request = \FabysCore\Component\HTTP\ServerRequest::createNew([], [], [], [], ["REQUEST_METHOD" => "GET", "HTTP_HOST" => "localhost", "REQUEST_URI" => "/", "SCRIPT_NAME" => "index.php"]); $response = new \FabysCore\Component\HTTP\Response(); $pdoStub = $this->getMock("TestPDO"); $database = new Database($pdoStub); $called = false; $database->init($request, $response, function (\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response) use(&$called) { $called = true; $this->assertInstanceOf(Database::class, $request->getAttribute(Database::REQUEST_ATTRIBUTE)); }); $this->assertTrue($called); }