Unverified Commit 0eae85a6 authored by alexpott's avatar alexpott
Browse files

Issue #3126971 by mondrake, alexpott, longwave: Replace usage of...

Issue #3126971 by mondrake, alexpott, longwave: Replace usage of getObjectAttribute() that is deprecated

(cherry picked from commit b739bebc)
parent 5a0caaf8
...@@ -52,11 +52,19 @@ public function testIsCompatible() { ...@@ -52,11 +52,19 @@ public function testIsCompatible() {
public function testSerialization() { public function testSerialization() {
$dependency = new Dependency('paragraphs_demo', 'paragraphs', '>8.x-1.1'); $dependency = new Dependency('paragraphs_demo', 'paragraphs', '>8.x-1.1');
$this->assertTrue($dependency->isCompatible('1.2')); $this->assertTrue($dependency->isCompatible('1.2'));
$this->assertInstanceOf(Constraint::class, $this->getObjectAttribute($dependency, 'constraint')); $reflected_constraint = (new \ReflectionObject($dependency))->getProperty('constraint');
$reflected_constraint->setAccessible(TRUE);
$constraint = $reflected_constraint->getValue($dependency);
$this->assertInstanceOf(Constraint::class, $constraint);
$dependency = unserialize(serialize($dependency)); $dependency = unserialize(serialize($dependency));
$this->assertNull($this->getObjectAttribute($dependency, 'constraint')); $reflected_constraint = (new \ReflectionObject($dependency))->getProperty('constraint');
$reflected_constraint->setAccessible(TRUE);
$constraint = $reflected_constraint->getValue($dependency);
$this->assertNull($constraint);
$this->assertTrue($dependency->isCompatible('1.2')); $this->assertTrue($dependency->isCompatible('1.2'));
$this->assertInstanceOf(Constraint::class, $this->getObjectAttribute($dependency, 'constraint')); $constraint = $reflected_constraint->getValue($dependency);
$this->assertInstanceOf(Constraint::class, $constraint);
} }
} }
...@@ -376,7 +376,9 @@ public function testSerialization() { ...@@ -376,7 +376,9 @@ public function testSerialization() {
$store = unserialize(serialize($this->tempStore)); $store = unserialize(serialize($this->tempStore));
$this->assertInstanceOf(SharedTempStore::class, $store); $this->assertInstanceOf(SharedTempStore::class, $store);
$request_stack = $this->getObjectAttribute($store, 'requestStack'); $reflected_request_stack = (new \ReflectionObject($store))->getProperty('requestStack');
$reflected_request_stack->setAccessible(TRUE);
$request_stack = $reflected_request_stack->getValue($store);
$this->assertEquals($this->requestStack, $request_stack); $this->assertEquals($this->requestStack, $request_stack);
$this->assertSame($unserializable_request, $request_stack->pop()); $this->assertSame($unserializable_request, $request_stack->pop());
} }
......
...@@ -23,7 +23,7 @@ trait PHPUnit8Warnings { ...@@ -23,7 +23,7 @@ trait PHPUnit8Warnings {
* @var string[] * @var string[]
*/ */
private static $ignoredWarnings = [ private static $ignoredWarnings = [
'getObjectAttribute() is deprecated and will be removed in PHPUnit 9.', // Temporarily empty.
]; ];
/** /**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment