-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Tests] Streamline #52365
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
[Tests] Streamline #52365
Conversation
public function testNoTwigTemplateActionMethod() | ||
{ | ||
$controller = new TemplateController(); | ||
|
||
$this->expectException(\LogicException::class); | ||
$this->expectExceptionMessage('You cannot use the TemplateController if the Twig Bundle is not available.'); | ||
$controller = new TemplateController(); | ||
|
||
$controller->templateAction('mytemplate')->getContent(); | ||
} | ||
|
||
public function testNoTwigInvokeMethod() | ||
{ | ||
$controller = new TemplateController(); | ||
|
||
$this->expectException(\LogicException::class); | ||
$this->expectExceptionMessage('You cannot use the TemplateController if the Twig Bundle is not available.'); | ||
|
||
$controller('mytemplate')->getContent(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should test both ways independently
@@ -125,8 +125,7 @@ public function testInvalidIpsInAccessControl() | |||
$this->expectException(\LogicException::class); | |||
$this->expectExceptionMessage('The given value "256.357.458.559" in the "security.access_control" config option is not a valid IP address.'); | |||
|
|||
$client = $this->createClient(['test_case' => 'StandardFormLogin', 'root_config' => 'invalid_ip_access_control.yml']); | |||
$client->request('GET', '/unprotected_resource'); | |||
$this->createClient(['test_case' => 'StandardFormLogin', 'root_config' => 'invalid_ip_access_control.yml']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exception is thrown while creating the Client, no need to call request()
@@ -342,7 +342,7 @@ public function testPhpinfoActionWithProfilerDisabled() | |||
$twig = $this->createMock(Environment::class); | |||
|
|||
$controller = new ProfilerController($urlGenerator, null, $twig, []); | |||
$controller->phpinfoAction(Request::create('/_profiler/phpinfo')); | |||
$controller->phpinfoAction(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
phpInfoAction
has no parameter
Ready to merge from my side |
b98d3c4
to
bf71742
Compare
@nicolas-grekas as PRs get bigger and bigger, can you please merge/upmerge this one? Thanks |
$table = new Table($output = $this->getOutputStream()); | ||
$table = new Table($this->getOutputStream()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused variable $output
$table | ||
->setHeaders(['ISBN', 'Title', 'Author', 'Price']) | ||
->setRows([ | ||
['99921-58-10-7', [], 'Dante Alighieri', '9.95'], | ||
]); | ||
|
||
$this->expectException(InvalidArgumentException::class); | ||
$this->expectExceptionMessage('A cell must be a TableCell, a scalar or an object implementing "__toString()", "array" given.'); | ||
|
||
$table->render(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stof it seems, that this is no dead code, as the exception is raised when calling render()
and not when calling setRows()
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
then in the other PR, keep setRows
in initialization
Fabbot looks unrelated |
a8c9052
to
918f677
Compare
Thank you @OskarStark. |
…e expectation to avoid false positives (OskarStark) This PR was merged into the 6.4 branch. Discussion ---------- [Tests] Move `expectException` closer to the place of the expectation to avoid false positives | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | -- | License | MIT If you guys like this PR, I will fix the other places as well Should be merged after merge & upmerge of: * #52365 Commits ------- 6115ab0 [Tests] Move expectException closer to the place of the expectation to avoid false positives
This PR was squashed before being merged into the 7.1 branch. Discussion ---------- [Tests] Streamline | Q | A | ------------- | --- | Branch? | 7.1 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | -- | License | MIT Follows * #52157 * #52365 Commits ------- 33d71aa [Tests] Streamline
Extracted from #52157