Remove calls to deprecated function assertAttributeX

This commit is contained in:
Jérémy Derussé 2019-08-04 11:16:42 +02:00
parent 8f87a85c07
commit d098c11539
No known key found for this signature in database
GPG Key ID: 2083FA5758C473D2
2 changed files with 12 additions and 12 deletions

View File

@ -61,14 +61,14 @@ class GenericEventTest extends TestCase
public function testSetArguments() public function testSetArguments()
{ {
$result = $this->event->setArguments(['foo' => 'bar']); $result = $this->event->setArguments(['foo' => 'bar']);
$this->assertAttributeSame(['foo' => 'bar'], 'arguments', $this->event); $this->assertSame(['foo' => 'bar'], $this->event->getArguments());
$this->assertSame($this->event, $result); $this->assertSame($this->event, $result);
} }
public function testSetArgument() public function testSetArgument()
{ {
$result = $this->event->setArgument('foo2', 'bar2'); $result = $this->event->setArgument('foo2', 'bar2');
$this->assertAttributeSame(['name' => 'Event', 'foo2' => 'bar2'], 'arguments', $this->event); $this->assertSame(['name' => 'Event', 'foo2' => 'bar2'], $this->event->getArguments());
$this->assertEquals($this->event, $result); $this->assertEquals($this->event, $result);
} }
@ -97,13 +97,13 @@ class GenericEventTest extends TestCase
public function testOffsetSet() public function testOffsetSet()
{ {
$this->event['foo2'] = 'bar2'; $this->event['foo2'] = 'bar2';
$this->assertAttributeSame(['name' => 'Event', 'foo2' => 'bar2'], 'arguments', $this->event); $this->assertSame(['name' => 'Event', 'foo2' => 'bar2'], $this->event->getArguments());
} }
public function testOffsetUnset() public function testOffsetUnset()
{ {
unset($this->event['name']); unset($this->event['name']);
$this->assertAttributeSame([], 'arguments', $this->event); $this->assertSame([], $this->event->getArguments());
} }
public function testOffsetIsset() public function testOffsetIsset()

View File

@ -324,15 +324,15 @@ class PdoSessionHandlerTest extends TestCase
public function testUrlDsn($url, $expectedDsn, $expectedUser = null, $expectedPassword = null) public function testUrlDsn($url, $expectedDsn, $expectedUser = null, $expectedPassword = null)
{ {
$storage = new PdoSessionHandler($url); $storage = new PdoSessionHandler($url);
$reflection = new \ReflectionClass(PdoSessionHandler::class);
$this->assertAttributeEquals($expectedDsn, 'dsn', $storage); foreach (['dsn' => $expectedDsn, 'username' => $expectedUser, 'password' => $expectedPassword] as $property => $expectedValue) {
if (!isset($expectedValue)) {
if (null !== $expectedUser) { continue;
$this->assertAttributeEquals($expectedUser, 'username', $storage); }
} $property = $reflection->getProperty($property);
$property->setAccessible(true);
if (null !== $expectedPassword) { $this->assertSame($expectedValue, $property->getValue($storage));
$this->assertAttributeEquals($expectedPassword, 'password', $storage);
} }
} }