[FOLLOWUP][!!!][TASK] Replace ClassInfo with ClassSchema 82/54482/2
authorAlexander Schnitzler <git@alexanderschnitzler.de>
Fri, 27 Oct 2017 10:23:36 +0000 (12:23 +0200)
committerMarkus Klein <markus.klein@typo3.org>
Tue, 31 Oct 2017 06:42:25 +0000 (07:42 +0100)
Increase test coverage of ClassSchema and ReflectionService

Releases: master
Resolves: #57594
Resolves: #55654
Change-Id: If413dc0b428f94dffef13e1875e3a7af4f9939b7
Reviewed-on: https://review.typo3.org/54482
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Jigal van Hemert <jigal.van.hemert@typo3.org>
Tested-by: Jigal van Hemert <jigal.van.hemert@typo3.org>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
12 files changed:
typo3/sysext/extbase/Classes/Reflection/ClassSchema.php
typo3/sysext/extbase/Classes/Reflection/ReflectionService.php
typo3/sysext/extbase/Tests/Unit/Reflection/ClassSchemaTest.php
typo3/sysext/extbase/Tests/Unit/Reflection/Fixture/DummyClassWithAllTypesOfMethods.php
typo3/sysext/extbase/Tests/Unit/Reflection/Fixture/DummyClassWithAllTypesOfProperties.php
typo3/sysext/extbase/Tests/Unit/Reflection/Fixture/DummyClassWithConstructorAndWithoutConstructorArguments.php [new file with mode: 0644]
typo3/sysext/extbase/Tests/Unit/Reflection/Fixture/DummyClassWithTags.php [new file with mode: 0644]
typo3/sysext/extbase/Tests/Unit/Reflection/Fixture/DummyClassWithoutConstructor.php [new file with mode: 0644]
typo3/sysext/extbase/Tests/Unit/Reflection/Fixture/DummyEntity.php [new file with mode: 0644]
typo3/sysext/extbase/Tests/Unit/Reflection/Fixture/DummySingleton.php [new file with mode: 0644]
typo3/sysext/extbase/Tests/Unit/Reflection/Fixture/DummyValueObject.php [new file with mode: 0644]
typo3/sysext/extbase/Tests/Unit/Reflection/ReflectionServiceTest.php

index e7ca5a3..5806386 100644 (file)
@@ -96,7 +96,7 @@ class ClassSchema
     /**
      * @var array
      */
-    private $tags;
+    private $tags = [];
 
     /**
      * @var array
index 14957f4..400a3c9 100644 (file)
@@ -88,7 +88,13 @@ class ReflectionService implements SingletonInterface
      */
     public function getClassTagsValues($className): array
     {
-        return $this->getClassSchema($className)->getTags();
+        try {
+            $classSchema = $this->getClassSchema($className);
+        } catch (\Exception $e) {
+            return [];
+        }
+
+        return $classSchema->getTags();
     }
 
     /**
@@ -100,7 +106,13 @@ class ReflectionService implements SingletonInterface
      */
     public function getClassTagValues($className, $tag): array
     {
-        return $this->getClassSchema($className)->getTags()[$tag];
+        try {
+            $classSchema = $this->getClassSchema($className);
+        } catch (\Exception $e) {
+            return [];
+        }
+
+        return $classSchema->getTags()[$tag];
     }
 
     /**
@@ -111,7 +123,13 @@ class ReflectionService implements SingletonInterface
      */
     public function getClassPropertyNames($className): array
     {
-        return array_keys($this->getClassSchema($className)->getProperties());
+        try {
+            $classSchema = $this->getClassSchema($className);
+        } catch (\Exception $e) {
+            return [];
+        }
+
+        return array_keys($classSchema->getProperties());
     }
 
     /**
@@ -141,7 +159,13 @@ class ReflectionService implements SingletonInterface
      */
     public function hasMethod($className, $methodName): bool
     {
-        return $this->getClassSchema($className)->hasMethod($methodName);
+        try {
+            $classSchema = $this->getClassSchema($className);
+        } catch (\Exception $e) {
+            return false;
+        }
+
+        return $classSchema->hasMethod($methodName);
     }
 
     /**
@@ -153,7 +177,13 @@ class ReflectionService implements SingletonInterface
      */
     public function getMethodTagsValues($className, $methodName): array
     {
-        return $this->getClassSchema($className)->getMethod($methodName)['tags'];
+        try {
+            $classSchema = $this->getClassSchema($className);
+        } catch (\Exception $e) {
+            return [];
+        }
+
+        return $classSchema->getMethod($methodName)['tags'];
     }
 
     /**
@@ -166,7 +196,13 @@ class ReflectionService implements SingletonInterface
      */
     public function getMethodParameters($className, $methodName): array
     {
-        return $this->getClassSchema($className)->getMethod($methodName)['params'];
+        try {
+            $classSchema = $this->getClassSchema($className);
+        } catch (\Exception $e) {
+            return [];
+        }
+
+        return $classSchema->getMethod($methodName)['params'];
     }
 
     /**
@@ -178,7 +214,15 @@ class ReflectionService implements SingletonInterface
      */
     public function getPropertyTagsValues($className, $propertyName): array
     {
-        return $this->getClassSchema($className)->getProperty($propertyName)['tags'];
+        try {
+            $classSchema = $this->getClassSchema($className);
+        } catch (\Exception $e) {
+            return [];
+        }
+
+        $propertyDefinition = $classSchema->getProperty($propertyName);
+
+        return isset($propertyDefinition['tags']) ? $propertyDefinition['tags'] : [];
     }
 
     /**
@@ -207,7 +251,13 @@ class ReflectionService implements SingletonInterface
      */
     public function isClassTaggedWith($className, $tag): bool
     {
-        foreach (array_keys($this->getClassSchema($className)->getTags()) as $tagName) {
+        try {
+            $classSchema = $this->getClassSchema($className);
+        } catch (\Exception $e) {
+            return false;
+        }
+
+        foreach (array_keys($classSchema->getTags()) as $tagName) {
             if ($tagName === $tag) {
                 return true;
             }
index 7a2f97c..5c7ce12 100644 (file)
@@ -17,7 +17,6 @@ namespace TYPO3\CMS\Extbase\Tests\Unit\Reflection;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
 use TYPO3\CMS\Extbase\Reflection\ClassSchema;
-use TYPO3\CMS\Extbase\Tests\Unit\Reflection\Fixture\DummyModel;
 
 /**
  * Test case
@@ -31,7 +30,7 @@ class ClassSchemaTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     {
         /** @var \TYPO3\CMS\Extbase\Reflection\ReflectionService $service */
         $service = GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Reflection\ReflectionService::class);
-        $classSchema = $service->getClassSchema(DummyModel::class);
+        $classSchema = $service->getClassSchema(Fixture\DummyModel::class);
         $this->assertTrue($classSchema->isAggregateRoot());
     }
 
@@ -46,9 +45,17 @@ class ClassSchemaTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
         $classSchema = new ClassSchema(Fixture\DummyClassWithConstructorAndConstructorArguments::class);
         static::assertTrue($classSchema->hasConstructor());
 
-        $methodDefinition = $classSchema->getMethod('__construct');
-        static::assertArrayHasKey('foo', $methodDefinition['params']);
-        static::assertArrayHasKey('bar', $methodDefinition['params']);
+        $constructorArguments = $classSchema->getConstructorArguments();
+        static::assertArrayHasKey('foo', $constructorArguments);
+        static::assertArrayHasKey('bar', $constructorArguments);
+
+        $classSchema = new ClassSchema(Fixture\DummyClassWithConstructorAndWithoutConstructorArguments::class);
+        static::assertTrue($classSchema->hasConstructor());
+        static::assertSame([], $classSchema->getConstructorArguments());
+
+        $classSchema = new ClassSchema(Fixture\DummyClassWithoutConstructor::class);
+        static::assertFalse($classSchema->hasConstructor());
+        static::assertSame([], $classSchema->getConstructorArguments());
     }
 
     public function testClassSchemaDetectsConstructorArgumentsWithDependencies()
@@ -61,6 +68,56 @@ class ClassSchemaTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
         static::assertSame(Fixture\DummyClassWithGettersAndSetters::class, $methodDefinition['params']['foo']['dependency']);
     }
 
+    public function testClassSchemaGetProperties()
+    {
+        static::assertSame(
+            [
+                'publicProperty',
+                'protectedProperty',
+                'privateProperty',
+                'publicStaticProperty',
+                'protectedStaticProperty',
+                'privateStaticProperty',
+                'propertyWithIgnoredTags',
+                'propertyWithInjectAnnotation',
+                'propertyWithTransientAnnotation',
+                'propertyWithCascadeAnnotation',
+                'propertyWithCascadeAnnotationWithoutVarAnnotation',
+                'propertyWithObjectStorageAnnotation'
+            ],
+            array_keys((new ClassSchema(Fixture\DummyClassWithAllTypesOfProperties::class))->getProperties())
+        );
+    }
+
+    public function testClassSchemaHasMethod()
+    {
+        $classSchema = new ClassSchema(Fixture\DummyClassWithAllTypesOfMethods::class);
+        static::assertTrue($classSchema->hasMethod('publicMethod'));
+        static::assertFalse($classSchema->hasMethod('nonExistentMethod'));
+    }
+
+    public function testClassSchemaGetMethods()
+    {
+        static::assertSame(
+            [
+                'publicMethod',
+                'protectedMethod',
+                'privateMethod',
+                'methodWithIgnoredTags',
+                'injectSettings',
+                'injectMethodWithoutParam',
+                'injectMethodThatIsProtected',
+                'injectFoo',
+                'staticMethod',
+                'methodWithMandatoryParam',
+                'methodWithNullableParam',
+                'methodWithDefaultValueParam',
+                'methodWithTypeHintedParam'
+            ],
+            array_keys((new ClassSchema(Fixture\DummyClassWithAllTypesOfMethods::class))->getMethods())
+        );
+    }
+
     public function testClassSchemaDetectsMethodVisibility()
     {
         $classSchema = new ClassSchema(Fixture\DummyClassWithAllTypesOfMethods::class);
@@ -81,9 +138,22 @@ class ClassSchemaTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
         static::assertTrue($methodDefinition['private']);
     }
 
+    public function testClassSchemaDetectsInjectProperties()
+    {
+        $classSchema = new ClassSchema(Fixture\DummyClassWithAllTypesOfProperties::class);
+        static::assertTrue($classSchema->hasInjectProperties());
+
+        $propertyDefinition = $classSchema->getProperty('propertyWithInjectAnnotation');
+        static::assertTrue($propertyDefinition['annotations']['inject']);
+
+        $injectProperties = $classSchema->getInjectProperties();
+        static::assertArrayHasKey('propertyWithInjectAnnotation', $injectProperties);
+    }
+
     public function testClassSchemaDetectsInjectMethods()
     {
         $classSchema = new ClassSchema(Fixture\DummyClassWithAllTypesOfMethods::class);
+        static::assertTrue($classSchema->hasInjectMethods());
 
         $methodDefinition = $classSchema->getMethod('injectSettings');
         static::assertFalse($methodDefinition['injectMethod']);
@@ -96,6 +166,9 @@ class ClassSchemaTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
 
         $methodDefinition = $classSchema->getMethod('injectFoo');
         static::assertTrue($methodDefinition['injectMethod']);
+
+        $injectMethods = $classSchema->getInjectMethods();
+        static::assertArrayHasKey('injectFoo', $injectMethods);
     }
 
     public function testClassSchemaDetectsStaticMethods()
@@ -198,4 +271,59 @@ class ClassSchemaTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
         static::assertSame(ObjectStorage::class, $propertyDefinition['type']);
         static::assertSame(Fixture\DummyClassWithAllTypesOfProperties::class, $propertyDefinition['elementType']);
     }
+
+    public function testClassSchemaDetectsSingletons()
+    {
+        static::assertTrue((new ClassSchema(Fixture\DummySingleton::class))->isSingleton());
+    }
+
+    public function testClassSchemaDetectsModels()
+    {
+        static::assertTrue((new ClassSchema(Fixture\DummyEntity::class))->isModel());
+        static::assertTrue((new ClassSchema(Fixture\DummyValueObject::class))->isModel());
+    }
+
+    public function testClassSchemaDetectsEntities()
+    {
+        static::assertTrue((new ClassSchema(Fixture\DummyEntity::class))->isEntity());
+    }
+
+    public function testClassSchemaDetectsValueObjects()
+    {
+        static::assertTrue((new ClassSchema(Fixture\DummyValueObject::class))->isValueObject());
+    }
+
+    public function testClassSchemaDetectsClassName()
+    {
+        static::assertSame(Fixture\DummyModel::class, (new ClassSchema(Fixture\DummyModel::class))->getClassName());
+    }
+
+    public function testClassSchemaDetectsNonStaticProperties()
+    {
+        static::assertTrue((new ClassSchema(Fixture\DummyClassWithAllTypesOfProperties::class))->hasProperty('publicProperty'));
+        static::assertTrue((new ClassSchema(Fixture\DummyClassWithAllTypesOfProperties::class))->hasProperty('protectedProperty'));
+        static::assertTrue((new ClassSchema(Fixture\DummyClassWithAllTypesOfProperties::class))->hasProperty('privateProperty'));
+    }
+
+    public function testClassSchemaDetectsStaticProperties()
+    {
+        static::assertTrue((new ClassSchema(Fixture\DummyClassWithAllTypesOfProperties::class))->hasProperty('publicStaticProperty'));
+        static::assertTrue((new ClassSchema(Fixture\DummyClassWithAllTypesOfProperties::class))->hasProperty('protectedStaticProperty'));
+        static::assertTrue((new ClassSchema(Fixture\DummyClassWithAllTypesOfProperties::class))->hasProperty('privateStaticProperty'));
+    }
+
+    public function testClassSchemaGetTags()
+    {
+        $tags = (new ClassSchema(Fixture\DummyClassWithTags::class))->getTags();
+        static::assertArrayHasKey('foo', $tags);
+
+        // test ignored tags
+        static::assertArrayNotHasKey('package', $tags);
+        static::assertArrayNotHasKey('subpackage', $tags);
+        static::assertArrayNotHasKey('license', $tags);
+        static::assertArrayNotHasKey('copyright', $tags);
+        static::assertArrayNotHasKey('author', $tags);
+        static::assertArrayNotHasKey('version', $tags);
+        static::assertArrayNotHasKey('const', $tags);
+    }
 }
index e34f09b..eaef15f 100644 (file)
@@ -33,6 +33,17 @@ class DummyClassWithAllTypesOfMethods
     {
     }
 
+    /**
+     * @license
+     * @copyright
+     * @author
+     * @version
+     * @const
+     */
+    public function methodWithIgnoredTags()
+    {
+    }
+
     public function injectSettings()
     {
         // Will fail, as injectSettings is blacklisted
index 6f336c2..624a415 100644 (file)
@@ -27,6 +27,21 @@ class DummyClassWithAllTypesOfProperties
 
     private $privateProperty;
 
+    public static $publicStaticProperty;
+
+    protected static $protectedStaticProperty;
+
+    private static $privateStaticProperty;
+
+    /**
+     * @license
+     * @copyright
+     * @author
+     * @version
+     * @const
+     */
+    public $propertyWithIgnoredTags;
+
     /**
      * @inject
      * @var DummyClassWithAllTypesOfProperties
diff --git a/typo3/sysext/extbase/Tests/Unit/Reflection/Fixture/DummyClassWithConstructorAndWithoutConstructorArguments.php b/typo3/sysext/extbase/Tests/Unit/Reflection/Fixture/DummyClassWithConstructorAndWithoutConstructorArguments.php
new file mode 100644 (file)
index 0000000..5450482
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+namespace TYPO3\CMS\Extbase\Tests\Unit\Reflection\Fixture;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+/**
+ * Fixture class with getters and setters
+ *
+ * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
+ */
+class DummyClassWithConstructorAndWithoutConstructorArguments
+{
+    public function __construct()
+    {
+    }
+}
diff --git a/typo3/sysext/extbase/Tests/Unit/Reflection/Fixture/DummyClassWithTags.php b/typo3/sysext/extbase/Tests/Unit/Reflection/Fixture/DummyClassWithTags.php
new file mode 100644 (file)
index 0000000..37e634e
--- /dev/null
@@ -0,0 +1,30 @@
+<?php
+namespace TYPO3\CMS\Extbase\Tests\Unit\Reflection\Fixture;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+/**
+ * Fixture class with tags
+ *
+ * @license
+ * @copyright
+ * @author
+ * @version
+ * @const
+ *
+ * @foo
+ */
+class DummyClassWithTags
+{
+}
diff --git a/typo3/sysext/extbase/Tests/Unit/Reflection/Fixture/DummyClassWithoutConstructor.php b/typo3/sysext/extbase/Tests/Unit/Reflection/Fixture/DummyClassWithoutConstructor.php
new file mode 100644 (file)
index 0000000..c19901a
--- /dev/null
@@ -0,0 +1,24 @@
+<?php
+namespace TYPO3\CMS\Extbase\Tests\Unit\Reflection\Fixture;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+/**
+ * Fixture class with getters and setters
+ *
+ * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
+ */
+class DummyClassWithoutConstructor
+{
+}
diff --git a/typo3/sysext/extbase/Tests/Unit/Reflection/Fixture/DummyEntity.php b/typo3/sysext/extbase/Tests/Unit/Reflection/Fixture/DummyEntity.php
new file mode 100644 (file)
index 0000000..2cdabd4
--- /dev/null
@@ -0,0 +1,26 @@
+<?php
+declare(strict_types=1);
+
+namespace TYPO3\CMS\Extbase\Tests\Unit\Reflection\Fixture;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
+
+/**
+ * Dummy Entity
+ */
+class DummyEntity extends AbstractEntity
+{
+}
diff --git a/typo3/sysext/extbase/Tests/Unit/Reflection/Fixture/DummySingleton.php b/typo3/sysext/extbase/Tests/Unit/Reflection/Fixture/DummySingleton.php
new file mode 100644 (file)
index 0000000..12e6852
--- /dev/null
@@ -0,0 +1,26 @@
+<?php
+declare(strict_types=1);
+
+namespace TYPO3\CMS\Extbase\Tests\Unit\Reflection\Fixture;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+use TYPO3\CMS\Core\SingletonInterface;
+
+/**
+ * Dummy Singleton
+ */
+class DummySingleton implements SingletonInterface
+{
+}
diff --git a/typo3/sysext/extbase/Tests/Unit/Reflection/Fixture/DummyValueObject.php b/typo3/sysext/extbase/Tests/Unit/Reflection/Fixture/DummyValueObject.php
new file mode 100644 (file)
index 0000000..8444069
--- /dev/null
@@ -0,0 +1,26 @@
+<?php
+declare(strict_types=1);
+
+namespace TYPO3\CMS\Extbase\Tests\Unit\Reflection\Fixture;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+use TYPO3\CMS\Extbase\DomainObject\AbstractValueObject;
+
+/**
+ * Dummy ValueObject
+ */
+class DummyValueObject extends AbstractValueObject
+{
+}
index 9f12e29..538ef66 100644 (file)
@@ -52,6 +52,11 @@ class ReflectionServiceTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCa
             'firsttest' => ['test for reflection'],
             'anothertest' => ['second test for reflection', 'second test for reflection with second value']
         ], $classValues);
+
+        $this->assertEquals(
+            [],
+            $service->getClassTagsValues('NonExistantNamespace\\NonExistantClass')
+        );
     }
 
     /**
@@ -64,6 +69,11 @@ class ReflectionServiceTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCa
         $this->assertEquals([
             'test for reflection',
         ], $classValues);
+
+        $this->assertEquals(
+            [],
+            $service->getClassTagValues('NonExistantNamespace\\NonExistantClass', 'nonExistantTag')
+        );
     }
 
     /**
@@ -74,6 +84,7 @@ class ReflectionServiceTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCa
         $service = GeneralUtility::makeInstance(ReflectionService::class);
         $this->assertTrue($service->hasMethod(static::class, 'fixtureMethodForMethodTagsValues'));
         $this->assertFalse($service->hasMethod(static::class, 'notExistentMethod'));
+        $this->assertFalse($service->hasMethod('NonExistantNamespace\\NonExistantClass', 'notExistentMethod'));
     }
 
     /**
@@ -87,6 +98,11 @@ class ReflectionServiceTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCa
             'param' => ['array $foo The foo parameter'],
             'return' => ['string']
         ], $tagsValues);
+
+        $this->assertEquals(
+            [],
+            $service->getMethodTagsValues('NonExistantNamespace\\NonExistantClass', 'notExistentMethod')
+        );
     }
 
     /**
@@ -112,6 +128,11 @@ class ReflectionServiceTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCa
                 'dependency' =>  null,
             ]
         ], $parameters);
+
+        $this->assertSame(
+            [],
+            $service->getMethodParameters('NonExistantNamespace\\NonExistantClass', 'notExistentMethod')
+        );
     }
 
     /**
@@ -152,4 +173,136 @@ class ReflectionServiceTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCa
             ]
         ], $parameters);
     }
+
+    public function testIsClassTaggedWith()
+    {
+        $service = GeneralUtility::makeInstance(ReflectionService::class);
+        $this->assertTrue($service->isClassTaggedWith(
+            Fixture\DummyClassWithTags::class,
+            'foo'
+        ));
+
+        $this->assertFalse($service->isClassTaggedWith(
+            Fixture\DummyClassWithAllTypesOfProperties::class,
+            'bar'
+        ));
+
+        $this->assertFalse($service->isClassTaggedWith(
+            'NonExistantNamespace\\NonExistantClass',
+            'foo'
+        ));
+    }
+
+    public function testIsPropertyTaggedWith()
+    {
+        $service = GeneralUtility::makeInstance(ReflectionService::class);
+        $this->assertTrue($service->isPropertyTaggedWith(
+            Fixture\DummyClassWithAllTypesOfProperties::class,
+            'propertyWithInjectAnnotation',
+            'inject'
+        ));
+
+        $this->assertFalse($service->isPropertyTaggedWith(
+            Fixture\DummyClassWithAllTypesOfProperties::class,
+            'propertyWithInjectAnnotation',
+            'foo'
+        ));
+
+        $this->assertFalse($service->isPropertyTaggedWith(
+            Fixture\DummyClassWithAllTypesOfProperties::class,
+            'nonExistantProperty',
+            'foo'
+        ));
+
+        $this->assertFalse($service->isPropertyTaggedWith(
+            'NonExistantNamespace\\NonExistantClass',
+            'propertyWithInjectAnnotation',
+            'inject'
+        ));
+    }
+
+    public function testgetPropertyTagValues()
+    {
+        $service = GeneralUtility::makeInstance(ReflectionService::class);
+
+        $this->assertSame(
+            [],
+            $service->getPropertyTagValues(
+                Fixture\DummyClassWithAllTypesOfProperties::class,
+                'propertyWithInjectAnnotation',
+                'foo'
+            )
+        );
+
+        $this->assertSame(
+            [],
+            $service->getPropertyTagValues(
+            Fixture\DummyClassWithAllTypesOfProperties::class,
+            'propertyWithInjectAnnotation',
+            'inject'
+            )
+        );
+    }
+
+    public function testGetPropertyTagsValues()
+    {
+        $service = GeneralUtility::makeInstance(ReflectionService::class);
+
+        $this->assertSame(
+            [
+                'inject' => [],
+                'var' => [
+                    'DummyClassWithAllTypesOfProperties'
+                ]
+            ],
+            $service->getPropertyTagsValues(
+                Fixture\DummyClassWithAllTypesOfProperties::class,
+                'propertyWithInjectAnnotation'
+            )
+        );
+
+        $this->assertSame(
+            [],
+            $service->getPropertyTagsValues(
+                Fixture\DummyClassWithAllTypesOfProperties::class,
+                'nonExistantProperty'
+            )
+        );
+
+        $this->assertSame(
+            [],
+            $service->getPropertyTagsValues(
+                'NonExistantNamespace\\NonExistantClass',
+                'nonExistantProperty'
+            )
+        );
+    }
+
+    public function testGetClassPropertyNames()
+    {
+        $service = GeneralUtility::makeInstance(ReflectionService::class);
+
+        $this->assertSame(
+            [
+                'publicProperty',
+                'protectedProperty',
+                'privateProperty',
+                'publicStaticProperty',
+                'protectedStaticProperty',
+                'privateStaticProperty',
+                'propertyWithIgnoredTags',
+                'propertyWithInjectAnnotation',
+                'propertyWithTransientAnnotation',
+                'propertyWithCascadeAnnotation',
+                'propertyWithCascadeAnnotationWithoutVarAnnotation',
+                'propertyWithObjectStorageAnnotation'
+            ],
+            $service->getClassPropertyNames(Fixture\DummyClassWithAllTypesOfProperties::class)
+        );
+
+        $this->assertSame(
+            [],
+            $service->getClassPropertyNames('NonExistantNamespace\\NonExistantClass')
+        );
+    }
 }