aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/config/ConfigJsonTest.php
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2020-09-29 11:36:27 +0200
committerGitHub <noreply@github.com>2020-09-29 11:36:27 +0200
commit6cdca9562c7685e9a0eb77b51584d0cc458c44e0 (patch)
tree518de2057da549d0baa982c6aa689aa813377774 /tests/config/ConfigJsonTest.php
parentd0ae1ba273b6decea8d35ef79bfabb055b0fb6df (diff)
parentb1baca99f280570d0336b4d71ad1f9dca213a35b (diff)
downloadShaarli-6cdca9562c7685e9a0eb77b51584d0cc458c44e0.tar.gz
Shaarli-6cdca9562c7685e9a0eb77b51584d0cc458c44e0.tar.zst
Shaarli-6cdca9562c7685e9a0eb77b51584d0cc458c44e0.zip
Merge pull request #1572 from ArthurHoaro/feature/php8
Diffstat (limited to 'tests/config/ConfigJsonTest.php')
-rw-r--r--tests/config/ConfigJsonTest.php16
1 files changed, 8 insertions, 8 deletions
diff --git a/tests/config/ConfigJsonTest.php b/tests/config/ConfigJsonTest.php
index 33160eb0..f884b0c6 100644
--- a/tests/config/ConfigJsonTest.php
+++ b/tests/config/ConfigJsonTest.php
@@ -11,7 +11,7 @@ class ConfigJsonTest extends \PHPUnit\Framework\TestCase
11 */ 11 */
12 protected $configIO; 12 protected $configIO;
13 13
14 public function setUp() 14 protected function setUp(): void
15 { 15 {
16 $this->configIO = new ConfigJson(); 16 $this->configIO = new ConfigJson();
17 } 17 }
@@ -38,12 +38,12 @@ class ConfigJsonTest extends \PHPUnit\Framework\TestCase
38 38
39 /** 39 /**
40 * Read a non existent config file -> empty array. 40 * Read a non existent config file -> empty array.
41 *
42 * @expectedException \Exception
43 * @expectedExceptionMessageRegExp /An error occurred while parsing JSON configuration file \([\w\/\.]+\): error code #4/
44 */ 41 */
45 public function testReadInvalidJson() 42 public function testReadInvalidJson()
46 { 43 {
44 $this->expectException(\Exception::class);
45 $this->expectExceptionMessageRegExp(' /An error occurred while parsing JSON configuration file \\([\\w\\/\\.]+\\): error code #4/');
46
47 $this->configIO->read('tests/utils/config/configInvalid.json.php'); 47 $this->configIO->read('tests/utils/config/configInvalid.json.php');
48 } 48 }
49 49
@@ -110,22 +110,22 @@ class ConfigJsonTest extends \PHPUnit\Framework\TestCase
110 110
111 /** 111 /**
112 * Write to invalid path. 112 * Write to invalid path.
113 *
114 * @expectedException \Shaarli\Exceptions\IOException
115 */ 113 */
116 public function testWriteInvalidArray() 114 public function testWriteInvalidArray()
117 { 115 {
116 $this->expectException(\Shaarli\Exceptions\IOException::class);
117
118 $conf = array('conf' => 'value'); 118 $conf = array('conf' => 'value');
119 @$this->configIO->write(array(), $conf); 119 @$this->configIO->write(array(), $conf);
120 } 120 }
121 121
122 /** 122 /**
123 * Write to invalid path. 123 * Write to invalid path.
124 *
125 * @expectedException \Shaarli\Exceptions\IOException
126 */ 124 */
127 public function testWriteInvalidBlank() 125 public function testWriteInvalidBlank()
128 { 126 {
127 $this->expectException(\Shaarli\Exceptions\IOException::class);
128
129 $conf = array('conf' => 'value'); 129 $conf = array('conf' => 'value');
130 @$this->configIO->write('', $conf); 130 @$this->configIO->write('', $conf);
131 } 131 }