From cbb8bc702c8fc9caf97970a6a318188d7b2fbe22 Mon Sep 17 00:00:00 2001 From: Kevin Frantz Date: Fri, 2 Nov 2018 20:28:42 +0100 Subject: [PATCH] Implemented Collection Attribut --- .../Entity/Attribut/CollectionAttribut.php | 29 +++++++++++++++ .../Attribut/CollectionAttributInterface.php | 12 +++++++ .../Attribut/CollectionAttributTest.php | 36 +++++++++++++++++++ 3 files changed, 77 insertions(+) create mode 100644 application/src/Entity/Attribut/CollectionAttribut.php create mode 100644 application/src/Entity/Attribut/CollectionAttributInterface.php create mode 100644 application/tests/Unit/Entity/Attribut/CollectionAttributTest.php diff --git a/application/src/Entity/Attribut/CollectionAttribut.php b/application/src/Entity/Attribut/CollectionAttribut.php new file mode 100644 index 0000000..8e0678b --- /dev/null +++ b/application/src/Entity/Attribut/CollectionAttribut.php @@ -0,0 +1,29 @@ +collection; + } + + /** + * @param Collection $collection + */ + public function setCollection(Collection $collection): void + { + $this->collection = $collection; + } +} diff --git a/application/src/Entity/Attribut/CollectionAttributInterface.php b/application/src/Entity/Attribut/CollectionAttributInterface.php new file mode 100644 index 0000000..6889cde --- /dev/null +++ b/application/src/Entity/Attribut/CollectionAttributInterface.php @@ -0,0 +1,12 @@ +collection = new class() implements CollectionAttributInterface { + use CollectionAttribut; + }; + } + + public function testConstructor(): void + { + $this->expectException(\TypeError::class); + $this->collection->getCollection(); + } + + public function testAccessors(): void + { + $collection = new ArrayCollection(); + $this->assertNull($this->collection->setCollection($collection)); + $this->assertEquals($collection, $this->collection->getCollection()); + } +}