Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[PhpUnitBridge] Remove calls to deprecated function assertAttributeX #32923

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Remove calls to deprecated function assertAttributeX
  • Loading branch information
jderusse committed Aug 4, 2019
commit d098c1153980f477b1a639ba3025d84b37b30987
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ public function testGetArguments()
public function testSetArguments()
{
$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);
}

public function testSetArgument()
{
$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);
}

Expand Down Expand Up @@ -97,13 +97,13 @@ public function testOffsetGet()
public function testOffsetSet()
{
$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()
{
unset($this->event['name']);
$this->assertAttributeSame([], 'arguments', $this->event);
$this->assertSame([], $this->event->getArguments());
}

public function testOffsetIsset()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,15 +324,15 @@ public function testGetConnectionConnectsIfNeeded()
public function testUrlDsn($url, $expectedDsn, $expectedUser = null, $expectedPassword = null)
{
$storage = new PdoSessionHandler($url);

$this->assertAttributeEquals($expectedDsn, 'dsn', $storage);

if (null !== $expectedUser) {
$this->assertAttributeEquals($expectedUser, 'username', $storage);
}

if (null !== $expectedPassword) {
$this->assertAttributeEquals($expectedPassword, 'password', $storage);
$reflection = new \ReflectionClass(PdoSessionHandler::class);

foreach (['dsn' => $expectedDsn, 'username' => $expectedUser, 'password' => $expectedPassword] as $property => $expectedValue) {
if (!isset($expectedValue)) {
continue;
}
$property = $reflection->getProperty($property);
$property->setAccessible(true);
Copy link
Member Author

@jderusse jderusse Aug 4, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see how to keep the Test without reflection. (unless refactoring the way DSN is parsed or the connection is initialized, but it's not necessary IMHO)

$this->assertSame($expectedValue, $property->getValue($storage));
}
}

Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.