Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Fix CS
  • Loading branch information
Ener-Getick committed Jan 14, 2016
commit 8c3b92c3f03b7f5949dd34aab47a69e3f2a8584f
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ public function testAliasDefinitionContainsUnsupportedElements()
$loader->load('legacy_invalid_alias_definition.xml');
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This test does not test anything (there are no assertions)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It tests that loading this deprecated options doesn't throw an error yet.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It still needs an assertion to not be marked as risky.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Are you sure @Tobion? They are not marked as risky on my computer.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'd also prefer to have an assertion. There's always an expected outcome. Not throwing an exception is not really the one. The fact that alias is registered in the container might be a better idea.

Can we at least verify the alias was registered in the container please?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why not adding a test that the deprecation is actually triggered (we did something similar in the Yaml component)?


$this->assertTrue($container->has('bar'));

$this->assertCount(3, $deprecations);
$this->assertContains('Using the attribute "class" is deprecated for alias definition "bar"', $deprecations[0]);
$this->assertContains('Using the element "tag" is deprecated for alias definition "bar"', $deprecations[1]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ public function testAliasDefinitionContainsUnsupportedKeywords()
$loader->load('legacy_invalid_alias_definition.yml');

$this->assertTrue($container->has('foo'));

$this->assertCount(2, $deprecations);
$this->assertContains('The configuration key "factory" is unsupported for alias definition "foo"', $deprecations[0]);
$this->assertContains('The configuration key "parent" is unsupported for alias definition "foo"', $deprecations[1]);
Expand Down