From 49cba2866a4eb57fd2b6c027a2627014eb4a14cf Mon Sep 17 00:00:00 2001 From: Kevin Frantz Date: Sun, 27 Jan 2019 11:15:07 +0100 Subject: [PATCH] Implemented RequestAttribut --- .../symfony/src/Attribut/RequestAttribut.php | 34 ++++++++++++++++ .../src/Attribut/RequestAttributInterface.php | 21 ++++++++++ .../Unit/Attribut/RequestAttributTest.php | 39 +++++++++++++++++++ 3 files changed, 94 insertions(+) create mode 100644 application/symfony/src/Attribut/RequestAttribut.php create mode 100644 application/symfony/src/Attribut/RequestAttributInterface.php create mode 100644 application/symfony/tests/Unit/Attribut/RequestAttributTest.php diff --git a/application/symfony/src/Attribut/RequestAttribut.php b/application/symfony/src/Attribut/RequestAttribut.php new file mode 100644 index 0000000..6fa9b5c --- /dev/null +++ b/application/symfony/src/Attribut/RequestAttribut.php @@ -0,0 +1,34 @@ +request = $request; + } + + /** + * @return Request + */ + public function getRequest(): Request + { + return $this->request; + } +} diff --git a/application/symfony/src/Attribut/RequestAttributInterface.php b/application/symfony/src/Attribut/RequestAttributInterface.php new file mode 100644 index 0000000..1b13951 --- /dev/null +++ b/application/symfony/src/Attribut/RequestAttributInterface.php @@ -0,0 +1,21 @@ +requestAttribut = new class() implements RequestAttributInterface { + use RequestAttribut; + }; + } + + public function testConstruct(): void + { + $this->expectException(\TypeError::class); + $this->requestAttribut->getRequest(); + } + + public function testAccessors(): void + { + $request = $this->createMock(Request::class); + $this->assertNull($this->requestAttribut->setRequest($request)); + $this->assertEquals($request, $this->requestAttribut->getRequest()); + } +}