Unverified Commit b739bebc authored by Alex Pott's avatar Alex Pott
Browse files

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

Issue #3126971 by mondrake, alexpott, longwave: Replace usage of getObjectAttribute() that is deprecated
parent 50332db1
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -52,11 +52,19 @@ public function testIsCompatible() {
  public function testSerialization() {
    $dependency = new Dependency('paragraphs_demo', 'paragraphs', '>8.x-1.1');
    $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));
    $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->assertInstanceOf(Constraint::class, $this->getObjectAttribute($dependency, 'constraint'));
    $constraint = $reflected_constraint->getValue($dependency);
    $this->assertInstanceOf(Constraint::class, $constraint);
  }

}
+3 −1
Original line number Diff line number Diff line
@@ -376,7 +376,9 @@ public function testSerialization() {
    $store = unserialize(serialize($this->tempStore));
    $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->assertSame($unserializable_request, $request_stack->pop());
  }
+1 −1
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ trait PHPUnit8Warnings {
   * @var string[]
   */
  private static $ignoredWarnings = [
    'getObjectAttribute() is deprecated and will be removed in PHPUnit 9.',
    // Temporarily empty.
  ];

  /**