Tests > Reflection > getPropertyValues() method > make stronger verification of the dot-separated properties (get values of the chain)

This commit is contained in:
Meritoo
2019-04-13 19:03:23 +02:00
parent a56b325307
commit fa370be08a
2 changed files with 34 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
<?php
/**
* (c) Meritoo.pl, http://www.meritoo.pl
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Meritoo\Test\Common\Utilities\Reflection;
/**
* The J class.
* Used for testing the Reflection class.
*
* @author Meritoo <github@meritoo.pl>
* @copyright Meritoo <http://www.meritoo.pl>
*/
class J
{
private $f;
/**
* Class constructor
*/
public function __construct()
{
$this->f = new F(1000, 'New York', 'USA', 'john.scott');
}
}

View File

@@ -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()