From fa370be08a6380647c4b367c472a694f8524786b Mon Sep 17 00:00:00 2001 From: Meritoo Date: Sat, 13 Apr 2019 19:03:23 +0200 Subject: [PATCH] Tests > Reflection > getPropertyValues() method > make stronger verification of the dot-separated properties (get values of the chain) --- tests/Utilities/Reflection/J.php | 29 +++++++++++++++++++++++++++++ tests/Utilities/ReflectionTest.php | 5 +++++ 2 files changed, 34 insertions(+) create mode 100644 tests/Utilities/Reflection/J.php diff --git a/tests/Utilities/Reflection/J.php b/tests/Utilities/Reflection/J.php new file mode 100644 index 0000000..b646551 --- /dev/null +++ b/tests/Utilities/Reflection/J.php @@ -0,0 +1,29 @@ + + * @copyright Meritoo + */ +class J +{ + private $f; + + /** + * Class constructor + */ + public function __construct() + { + $this->f = new F(1000, 'New York', 'USA', 'john.scott'); + } +} diff --git a/tests/Utilities/ReflectionTest.php b/tests/Utilities/ReflectionTest.php index 86810d2..1862ee3 100644 --- a/tests/Utilities/ReflectionTest.php +++ b/tests/Utilities/ReflectionTest.php @@ -26,6 +26,7 @@ use Meritoo\Test\Common\Utilities\Reflection\F; use Meritoo\Test\Common\Utilities\Reflection\G; use Meritoo\Test\Common\Utilities\Reflection\H; use Meritoo\Test\Common\Utilities\Reflection\I; +use Meritoo\Test\Common\Utilities\Reflection\J; use ReflectionProperty; /** @@ -380,9 +381,13 @@ class ReflectionTest extends BaseTestCase public function testGetPropertyValuesFromChainAndSingleObject() { $f = new F(1000, 'New York', 'USA', 'john.scott'); + $j = new J(); self::assertEquals(['John'], Reflection::getPropertyValues($f, 'g.firstName')); self::assertEquals(['John'], Reflection::getPropertyValues($f, 'g.firstName', true)); + + self::assertEquals(['John'], Reflection::getPropertyValues($j, 'f.g.firstName')); + self::assertEquals(['John'], Reflection::getPropertyValues($j, 'f.g.firstName', true)); } public function testGetPropertyValuesFromChainAndMultipleObjects()