public function Util_ClassTest::testGetObjectAttributeCanHandleDynamicVariables

Test that if a dynamic variable is defined on a class then the $attribute variable will be NULL, but the variable defined will be a public one so we are safe to return it

Currently $attribute is NULL but we try and call isPublic() on it. This breaks for php 5.2.10

@covers PHPUnit_Util_Class::getObjectAttribute

Return value

void

File

drupal/core/vendor/phpunit/phpunit/Tests/Util/ClassTest.php, line 75

Class

Util_ClassTest
@package PHPUnit @author Sebastian Bergmann <sebastian@phpunit.de> @author Ben Selby <benmatselby@gmail.com> @copyright 2001-2013 Sebastian Bergmann <sebastian@phpunit.de> @license …

Code

public function testGetObjectAttributeCanHandleDynamicVariables() {
  $attributeName = '_variable';
  $object = new stdClass();
  $object->{$attributeName} = 'Test';
  $actual = PHPUnit_Util_Class::getObjectAttribute($object, $attributeName);
  $this
    ->assertEquals('Test', $actual);
}