From d119c001c1ee6202488421b70cd6530582ee24da Mon Sep 17 00:00:00 2001 From: Claudio Zizza Date: Tue, 20 Jun 2017 23:05:45 +0200 Subject: [PATCH] Add coverage for invalid service alias names --- .../Disco/Annotations/AliasUnitTest.php | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/bitExpert/Disco/Annotations/AliasUnitTest.php b/tests/bitExpert/Disco/Annotations/AliasUnitTest.php index 9db2f41..191018d 100644 --- a/tests/bitExpert/Disco/Annotations/AliasUnitTest.php +++ b/tests/bitExpert/Disco/Annotations/AliasUnitTest.php @@ -61,4 +61,27 @@ public function aliasShouldBeNamedOrTypeAlias() self::expectExceptionMessage('Alias should either be a named alias or a type alias!'); new Alias(); } + + /** + * @test + * @dataProvider invalidNameProvider + */ + public function aliasNameCannotBeEmpty($name) + { + self::expectException(AnnotationException::class); + self::expectExceptionMessage('Alias should either be a named alias or a type alias!'); + new Alias(['value' => ['name' => $name, 'type' => false]]); + } + + public function invalidNameProvider() + { + return [ + [''], + [0], + [0.0], + [false], + [null], + [[]], + ]; + } }