mirror of
https://github.com/wiosna-dev/common-library.git
synced 2026-03-12 09:31:51 +01:00
Tests > Reflection > getPropertyValues() method > make stronger verification of the dot-separated properties (get values of the chain)
This commit is contained in:
29
tests/Utilities/Reflection/J.php
Normal file
29
tests/Utilities/Reflection/J.php
Normal 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');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -26,6 +26,7 @@ use Meritoo\Test\Common\Utilities\Reflection\F;
|
|||||||
use Meritoo\Test\Common\Utilities\Reflection\G;
|
use Meritoo\Test\Common\Utilities\Reflection\G;
|
||||||
use Meritoo\Test\Common\Utilities\Reflection\H;
|
use Meritoo\Test\Common\Utilities\Reflection\H;
|
||||||
use Meritoo\Test\Common\Utilities\Reflection\I;
|
use Meritoo\Test\Common\Utilities\Reflection\I;
|
||||||
|
use Meritoo\Test\Common\Utilities\Reflection\J;
|
||||||
use ReflectionProperty;
|
use ReflectionProperty;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -380,9 +381,13 @@ class ReflectionTest extends BaseTestCase
|
|||||||
public function testGetPropertyValuesFromChainAndSingleObject()
|
public function testGetPropertyValuesFromChainAndSingleObject()
|
||||||
{
|
{
|
||||||
$f = new F(1000, 'New York', 'USA', 'john.scott');
|
$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'));
|
||||||
self::assertEquals(['John'], Reflection::getPropertyValues($f, 'g.firstName', true));
|
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()
|
public function testGetPropertyValuesFromChainAndMultipleObjects()
|
||||||
|
|||||||
Reference in New Issue
Block a user