-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Use a dedicated exception in the file locator #19511
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\Config\Exception; | ||
|
||
/** | ||
* File locator exception if a file does not exist. | ||
* | ||
* @author Leo Feyer <https://github.com/leofeyer> | ||
*/ | ||
class FileLocatorFileNotFoundException extends \InvalidArgumentException | ||
{ | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
|
||
namespace Symfony\Component\Config\Tests; | ||
|
||
use Symfony\Component\Config\Exception\FileLocatorFileNotFoundException; | ||
use Symfony\Component\Config\FileLocator; | ||
|
||
class FileLocatorTest extends \PHPUnit_Framework_TestCase | ||
|
@@ -86,7 +87,7 @@ public function testLocate() | |
} | ||
|
||
/** | ||
* @expectedException \InvalidArgumentException | ||
* @expectedException FileLocatorFileNotFoundException | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. phpunit doesn't handle use statements, should be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have updated the PR accordingly. However, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. PHP 7 requires a phpunit 5.* whereas phpunit 4.8 is the only option for PHP5.3 to 5.5. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That cannot be true. I am using PhpUnit 4.8 with PHP 7.0.
|
||
* @expectedExceptionMessage The file "foobar.xml" does not exist | ||
*/ | ||
public function testLocateThrowsAnExceptionIfTheFileDoesNotExists() | ||
|
@@ -97,7 +98,7 @@ public function testLocateThrowsAnExceptionIfTheFileDoesNotExists() | |
} | ||
|
||
/** | ||
* @expectedException \InvalidArgumentException | ||
* @expectedException FileLocatorFileNotFoundException | ||
*/ | ||
public function testLocateThrowsAnExceptionIfTheFileDoesNotExistsInAbsolutePath() | ||
{ | ||
|
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.
Why not simply
FileNotFoundException
? The current name is verboseThere 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.
Because the other exception classes also use a prefix: https://github.com/symfony/symfony/tree/master/src/Symfony/Component/Config/Exception
Just wanted to keep things consistent.