From 31e87a75d510c40b8c96e79d845c0fa7d18bd981 Mon Sep 17 00:00:00 2001 From: Oscar Otero Date: Mon, 11 Nov 2019 19:30:39 +0100 Subject: [PATCH] update to gettext/gettext 5.1.0 --- composer.json | 2 +- tests/PhpScannerTest.php | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 7376330..51a4f3e 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ "require": { "php": "^7.2", "nikic/php-parser": "^4.2", - "gettext/gettext": "^5.0" + "gettext/gettext": "^5.1" }, "require-dev": { "phpunit/phpunit": "^8.0", diff --git a/tests/PhpScannerTest.php b/tests/PhpScannerTest.php index 74e9b50..bc95a5d 100644 --- a/tests/PhpScannerTest.php +++ b/tests/PhpScannerTest.php @@ -2,6 +2,7 @@ namespace Gettext\Tests; +use Exception; use Gettext\Scanner\PhpScanner; use Gettext\Translations; use PHPUnit\Framework\TestCase; @@ -35,4 +36,27 @@ public function testPhpCodeScanner() $this->assertCount(4, $domain2); $this->assertCount(1, $domain3); } + + public function testInvalidFunction() + { + $this->expectException(Exception::class); + + $scanner = new PhpScanner(Translations::create('messages')); + $scanner->scanString('getTranslations()); + + $this->assertCount(0, $translations); + } + + public function testIgnoredInvalidFunction() + { + $scanner = new PhpScanner(Translations::create('messages')); + $scanner->ignoreInvalidFunctions(); + $scanner->scanString('getTranslations()); + + $this->assertCount(0, $translations); + } }