X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=tests%2Fconfig%2FConfigManagerTest.php;h=802e65246f3913adc14e24d03502fcfc14ace0f3;hb=refs%2Fpull%2F1572%2Fhead;hp=69456bce77b995c9a15427de9500f1bc680e7abb;hpb=8f60e1206e45e67c96a7630d4ff94e72fe875f09;p=github%2Fshaarli%2FShaarli.git diff --git a/tests/config/ConfigManagerTest.php b/tests/config/ConfigManagerTest.php index 69456bce..802e6524 100644 --- a/tests/config/ConfigManagerTest.php +++ b/tests/config/ConfigManagerTest.php @@ -95,44 +95,44 @@ class ConfigManagerTest extends \PHPUnit\Framework\TestCase /** * Set with an empty key. - * - * @expectedException \Exception - * @expectedExceptionMessageRegExp #^Invalid setting key parameter. String expected, got.*# */ public function testSetEmptyKey() { + $this->expectException(\Exception::class); + $this->expectExceptionMessageRegExp('#^Invalid setting key parameter. String expected, got.*#'); + $this->conf->set('', 'stuff'); } /** * Set with an array key. - * - * @expectedException \Exception - * @expectedExceptionMessageRegExp #^Invalid setting key parameter. String expected, got.*# */ public function testSetArrayKey() { + $this->expectException(\Exception::class); + $this->expectExceptionMessageRegExp('#^Invalid setting key parameter. String expected, got.*#'); + $this->conf->set(array('foo' => 'bar'), 'stuff'); } /** * Remove with an empty key. - * - * @expectedException \Exception - * @expectedExceptionMessageRegExp #^Invalid setting key parameter. String expected, got.*# */ public function testRmoveEmptyKey() { + $this->expectException(\Exception::class); + $this->expectExceptionMessageRegExp('#^Invalid setting key parameter. String expected, got.*#'); + $this->conf->remove(''); } /** * Try to write the config without mandatory parameter (e.g. 'login'). - * - * @expectedException Shaarli\Config\Exception\MissingFieldConfigException */ public function testWriteMissingParameter() { + $this->expectException(\Shaarli\Config\Exception\MissingFieldConfigException::class); + $this->conf->setConfigFile('tests/utils/config/configTmp'); $this->assertFalse(file_exists($this->conf->getConfigFileExt())); $this->conf->reload();