From 4066634af2617ceb3ca10129d7fd57c7d3e3f496 Mon Sep 17 00:00:00 2001 From: Kevin Frantz Date: Fri, 23 Nov 2018 21:30:25 +0100 Subject: [PATCH] Added Text source --- .../src/Entity/Attribut/TextAttribut.php | 21 ++++++++++ .../Entity/Attribut/TextAttributInterface.php | 10 +++++ .../Primitive/AbstractPrimitiveSource.php | 2 +- .../Source/Primitive/Text/TextSource.php | 23 +++++++++++ .../Primitive/Text/TextSourceInterface.php | 10 +++++ .../Unit/Entity/Attribut/TextAttributTest.php | 38 +++++++++++++++++++ .../Source/Primitive/Text/TextSourceTest.php | 26 +++++++++++++ 7 files changed, 129 insertions(+), 1 deletion(-) create mode 100644 application/src/Entity/Attribut/TextAttribut.php create mode 100644 application/src/Entity/Attribut/TextAttributInterface.php create mode 100644 application/src/Entity/Source/Primitive/Text/TextSource.php create mode 100644 application/src/Entity/Source/Primitive/Text/TextSourceInterface.php create mode 100644 application/tests/Unit/Entity/Attribut/TextAttributTest.php create mode 100644 application/tests/Unit/Entity/Source/Primitive/Text/TextSourceTest.php diff --git a/application/src/Entity/Attribut/TextAttribut.php b/application/src/Entity/Attribut/TextAttribut.php new file mode 100644 index 0000000..eb05481 --- /dev/null +++ b/application/src/Entity/Attribut/TextAttribut.php @@ -0,0 +1,21 @@ +text; + } + + public function setText(string $text): void + { + $this->text = $text; + } +} diff --git a/application/src/Entity/Attribut/TextAttributInterface.php b/application/src/Entity/Attribut/TextAttributInterface.php new file mode 100644 index 0000000..216dc90 --- /dev/null +++ b/application/src/Entity/Attribut/TextAttributInterface.php @@ -0,0 +1,10 @@ +textAttribut = new class() implements TextAttributInterface { + use TextAttribut; + }; + } + + public function testConstructor(): void + { + $this->expectException(\TypeError::class); + $this->textAttribut->getText(); + } + + public function testAccessors(): void + { + $text = 'Hello World!'; + $this->assertNull($this->textAttribut->setText($text)); + $this->assertEquals($text, $this->textAttribut->getText()); + } +} diff --git a/application/tests/Unit/Entity/Source/Primitive/Text/TextSourceTest.php b/application/tests/Unit/Entity/Source/Primitive/Text/TextSourceTest.php new file mode 100644 index 0000000..c34e020 --- /dev/null +++ b/application/tests/Unit/Entity/Source/Primitive/Text/TextSourceTest.php @@ -0,0 +1,26 @@ +textSource = new TextSource(); + } + + public function testConstructor(): void + { + $this->expectException(\TypeError::class); + $this->textSource->getText(); + } +}