Skip to content

Commit 99dfd08

Browse files
committed
fix(config): modify test case
1 parent 53fa6f0 commit 99dfd08

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

tests/ConfigTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use CuePhp\Config\Loader\File\JsonLoader;
1111
use CuePhp\Config\Loader\File\PhpLoader;
1212
use CuePhp\Config\Loader\File\YamlLoader;
13+
use TypeError;
1314

1415
class ConfigTest extends TestCase
1516
{
@@ -49,7 +50,7 @@ public function testConstructWithYml()
4950
$config = new Config(__DIR__ . '/mocks/pass/config.yml', new YamlLoader());
5051
$this->assertSame(1, $config->get('demo.section'));
5152
// TODO
52-
$this->expectException(LoaderException::class);
53+
$this->expectException(TypeError::class);
5354
$config = new Config(__DIR__ . '/mocks/pass/empty.yml', new YamlLoader());
5455
$this->assertSame([], $config->all());
5556
}
@@ -71,7 +72,7 @@ public function testConstructWithPhp()
7172
$config = new Config(__DIR__ . '/mocks/pass/config.php', new PhpLoader());
7273
$this->assertSame(1, $config->get('demo.section'));
7374
// TODO
74-
$this->expectException(LoaderException::class);
75+
$this->expectException(TypeError::class);
7576
$config = new Config(__DIR__ . '/mocks/pass/empty.php', new PhpLoader());
7677
$this->assertSame([], $config->all());
7778
}

tests/Loader/File/PhpLoaderTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use CuePhp\Config\Exception\LoaderException;
88
use PHPUnit\Framework\TestCase;
99
use CuePhp\Config\Loader\File\PhpLoader;
10+
use TypeError;
1011

1112
class PhpLoaderTest extends TestCase
1213
{
@@ -27,7 +28,7 @@ protected function tearDown(): void
2728

2829
public function testLoadInvalidPhpFile()
2930
{
30-
$this->expectException(LoaderException::class);
31+
$this->expectException(TypeError::class);
3132
$this->php->loadFromFile( __DIR__. '/../../mocks/fail/error.php' );
3233
}
3334

tests/Loader/File/YamlLoaderTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use CuePhp\Config\Exception\LoaderException;
88
use PHPUnit\Framework\TestCase;
99
use CuePhp\Config\Loader\File\YamlLoader;
10+
use TypeError;
1011

1112
class YamlLoaderTest extends TestCase
1213
{
@@ -26,7 +27,7 @@ protected function tearDown(): void
2627

2728
public function testLoadInvalidYml()
2829
{
29-
$this->expectException(LoaderException::class);
30+
$this->expectException(TypeError::class);
3031
$this->yml->loadFromFile( __DIR__. '/../../mocks/fail/error.yml' );
3132
}
3233

0 commit comments

Comments
 (0)