44use Noodlehaus \Parser \Json as JsonParser ;
55use Noodlehaus \Writer \Json as JsonWriter ;
66use PHPUnit \Framework \TestCase ;
7+ use Yoast \PHPUnitPolyfills \Polyfills \ExpectException ;
78
89/**
910 * Generated by PHPUnit_SkeletonGenerator 1.2.1 on 2014-04-21 at 22:37:22.
1011 */
1112class ConfigTest extends TestCase
1213{
14+ use ExpectException;
1315 /**
1416 * @var Config
1517 */
@@ -19,11 +21,11 @@ class ConfigTest extends TestCase
1921 * @covers Noodlehaus\Config::load()
2022 * @covers Noodlehaus\Config::loadFromFile()
2123 * @covers Noodlehaus\Config::getParser()
22- * @expectedException Noodlehaus\Exception\UnsupportedFormatException
23- * @expectedExceptionMessage Unsupported configuration format
2424 */
2525 public function testLoadWithUnsupportedFormat ()
2626 {
27+ $ this ->expectException (\Noodlehaus \Exception \UnsupportedFormatException::class);
28+ $ this ->expectExceptionMessage ('Unsupported configuration format ' );
2729 $ config = Config::load (__DIR__ . '/mocks/fail/error.lib ' );
2830 // $this->markTestIncomplete('Not yet implemented');
2931 }
@@ -32,11 +34,11 @@ public function testLoadWithUnsupportedFormat()
3234 * @covers Noodlehaus\Config::__construct()
3335 * @covers Noodlehaus\Config::loadFromFile()
3436 * @covers Noodlehaus\Config::getParser()
35- * @expectedException Noodlehaus\Exception\UnsupportedFormatException
36- * @expectedExceptionMessage Unsupported configuration format
3737 */
3838 public function testConstructWithUnsupportedFormat ()
3939 {
40+ $ this ->expectException (\Noodlehaus \Exception \UnsupportedFormatException::class);
41+ $ this ->expectExceptionMessage ('Unsupported configuration format ' );
4042 $ config = new Config (__DIR__ . '/mocks/fail/error.lib ' );
4143 }
4244
@@ -46,11 +48,11 @@ public function testConstructWithUnsupportedFormat()
4648 * @covers Noodlehaus\Config::getParser()
4749 * @covers Noodlehaus\Config::getPathFromArray()
4850 * @covers Noodlehaus\Config::getValidPath()
49- * @expectedException Noodlehaus\Exception\FileNotFoundException
50- * @expectedExceptionMessage Configuration file: [ladadeedee] cannot be found
5151 */
5252 public function testConstructWithInvalidPath ()
5353 {
54+ $ this ->expectException (\Noodlehaus \Exception \FileNotFoundException::class);
55+ $ this ->expectExceptionMessage ('Configuration file: [ladadeedee] cannot be found ' );
5456 $ config = new Config ('ladadeedee ' );
5557 }
5658
@@ -60,10 +62,10 @@ public function testConstructWithInvalidPath()
6062 * @covers Noodlehaus\Config::getParser()
6163 * @covers Noodlehaus\Config::getPathFromArray()
6264 * @covers Noodlehaus\Config::getValidPath()
63- * @expectedException Noodlehaus\Exception\EmptyDirectoryException
6465 */
6566 public function testConstructWithEmptyDirectory ()
6667 {
68+ $ this ->expectException (\Noodlehaus \Exception \EmptyDirectoryException::class);
6769 $ config = new Config (__DIR__ . '/mocks/empty ' );
6870 }
6971
@@ -91,10 +93,10 @@ public function testConstructWithArray()
9193 * @covers Noodlehaus\Config::getParser()
9294 * @covers Noodlehaus\Config::getPathFromArray()
9395 * @covers Noodlehaus\Config::getValidPath()
94- * @expectedException Noodlehaus\Exception\FileNotFoundException
9596 */
9697 public function testConstructWithArrayWithNonexistentFile ()
9798 {
99+ $ this ->expectException (\Noodlehaus \Exception \FileNotFoundException::class);
98100 $ paths = [__DIR__ . '/mocks/pass/config.xml ' , __DIR__ . '/mocks/pass/config3.json ' ];
99101 $ config = new Config ($ paths );
100102
0 commit comments