From 3b0b48ed3e06485fe89c9fc4fce510711aa658a1 Mon Sep 17 00:00:00 2001 From: Simon Wisselink Date: Fri, 11 Sep 2020 10:21:25 +0200 Subject: [PATCH] Updated UndefinedTemplateVarTest for PHP8 (and disabled a check for PHP<5.6) and re-enabled php:nightly in travis config --- .travis.yml | 2 +- .../UndefinedTemplateVarTest.php | 19 +++++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 21b766cf..80752e3d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,7 @@ matrix: - php: 7.2 - php: 7.3 - php: 7.4 -# - php: nightly # PHP nightly build testing disabled because PHPUnit doesn't support PHP8 yet. + - php: nightly # PHP nightly build testing disabled because PHPUnit doesn't support PHP8 yet. fast_finish: true allow_failures: - php: nightly diff --git a/tests/UnitTests/A_2/UndefinedTemplateVar/UndefinedTemplateVarTest.php b/tests/UnitTests/A_2/UndefinedTemplateVar/UndefinedTemplateVarTest.php index b40ff24e..229420f0 100644 --- a/tests/UnitTests/A_2/UndefinedTemplateVar/UndefinedTemplateVarTest.php +++ b/tests/UnitTests/A_2/UndefinedTemplateVar/UndefinedTemplateVarTest.php @@ -24,9 +24,9 @@ class UndefinedTemplateVarTest extends PHPUnit_Smarty $this->cleanDirs(); } /** - * Test E_NOTICE suppression template fetched by Smarty object + * Test Error suppression template fetched by Smarty object */ - public function testE_NoticeDisabled() + public function testErrorDisabled() { $e1 = error_reporting(); $this->smarty->setErrorReporting(E_ALL & ~E_WARNING & ~E_NOTICE); @@ -36,9 +36,9 @@ class UndefinedTemplateVarTest extends PHPUnit_Smarty } /** - * Test E_NOTICE suppression template fetched by template object + * Test Error suppression template fetched by template object */ - public function testE_NoticeDisabledTplObject_1() + public function testErrorDisabledTplObject_1() { $e1 = error_reporting(); $this->smarty->setErrorReporting(E_ALL & ~E_WARNING & ~E_NOTICE); @@ -48,7 +48,10 @@ class UndefinedTemplateVarTest extends PHPUnit_Smarty $this->assertEquals($e1, $e2); } - public function testE_NoticeDisabledTplObject_2() + /** + * Test Error suppression template object fetched by Smarty object + */ + public function testErrorDisabledTplObject_2() { $e1 = error_reporting(); $this->smarty->setErrorReporting(E_ALL & ~E_WARNING & ~E_NOTICE); @@ -59,14 +62,14 @@ class UndefinedTemplateVarTest extends PHPUnit_Smarty } /** - * Throw E_NOTICE message + * Throw Error message */ - public function testE_Notice() + public function testError() { if (PHP_VERSION_ID >= 80000) { $this->expectExceptionMessage("Undefined array key \"foo\""); $this->expectException(PHPUnit_Framework_Error_Warning::class); - } else { + } elseif (PHP_VERSION_ID >= 56000) { $this->expectExceptionMessage("Undefined index: foo"); $this->expectException(PHPUnit_Framework_Error_Notice::class); }