facile-it /
paraunit
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Paraunit\Tests\Unit\Configuration; |
||
| 4 | |||
| 5 | use Paraunit\Configuration\PHPUnitConfigFile; |
||
| 6 | |||
| 7 | class PHPUnitConfigFileTest extends \PHPUnit_Framework_TestCase |
||
| 8 | { |
||
| 9 | private $previousCWD; |
||
| 10 | |||
| 11 | protected function setUp() |
||
| 12 | { |
||
| 13 | parent::setUp(); |
||
| 14 | |||
| 15 | $this->previousCWD = getcwd(); |
||
| 16 | |||
| 17 | $stubPath = realpath(__DIR__ . '/../../Stub'); |
||
| 18 | chdir($stubPath); |
||
| 19 | } |
||
| 20 | |||
| 21 | protected function tearDown() |
||
| 22 | { |
||
| 23 | chdir($this->previousCWD); |
||
| 24 | $this->previousCWD = null; |
||
| 25 | |||
| 26 | parent::tearDown(); |
||
| 27 | } |
||
| 28 | |||
| 29 | public function testRelativeDirectoryDoesUseDefaultFileName() |
||
| 30 | { |
||
| 31 | $dir = 'StubbedXMLConfigs'; |
||
| 32 | |||
| 33 | $config = new PHPUnitConfigFile($dir); |
||
| 34 | |||
| 35 | $filePath = $config->getFileFullPath(); |
||
| 36 | $this->assertStringEndsWith(PHPUnitConfigFile::DEFAULT_FILE_NAME, $filePath); |
||
| 37 | |||
| 38 | $directoryPath = $config->getDirectory(); |
||
| 39 | $this->assertStringEndsWith($dir, $directoryPath); |
||
| 40 | } |
||
| 41 | |||
| 42 | public function testRelativeFilenameDoesNotUseDefaultFileName() |
||
| 43 | { |
||
| 44 | $file = 'StubbedXMLConfigs/stubbed_for_filter_test.xml'; |
||
| 45 | |||
| 46 | $config = new PHPUnitConfigFile($file); |
||
| 47 | |||
| 48 | $filePath = $config->getFileFullPath(); |
||
| 49 | |||
| 50 | $this->assertStringEndsNotWith(PHPUnitConfigFile::DEFAULT_FILE_NAME, $filePath); |
||
| 51 | } |
||
| 52 | |||
| 53 | public function testRelativeDirectoryAndDefaultFileDoesNotExistThrowException() |
||
| 54 | { |
||
| 55 | $dir = 'PHPUnitOutput'; |
||
| 56 | |||
| 57 | $this->setExpectedException('InvalidArgumentException', PHPUnitConfigFile::DEFAULT_FILE_NAME . ' does not exist'); |
||
|
0 ignored issues
–
show
|
|||
| 58 | |||
| 59 | new PHPUnitConfigFile($dir); |
||
| 60 | } |
||
| 61 | |||
| 62 | public function testInvalidDirectoryProvidedThrowException() |
||
| 63 | { |
||
| 64 | $dir = 'foobar'; |
||
| 65 | |||
| 66 | $this->setExpectedException('InvalidArgumentException', 'Config path/file provided is not valid'); |
||
|
0 ignored issues
–
show
The method
PHPUnit_Framework_TestCase::setExpectedException() has been deprecated with message: Method deprecated since Release 5.2.0
This method has been deprecated. The supplier of the class has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead. Loading history...
|
|||
| 67 | |||
| 68 | new PHPUnitConfigFile($dir); |
||
| 69 | } |
||
| 70 | } |
||
| 71 |
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.