diff --git a/src/Utils/FunctionsScanner.php b/src/Utils/FunctionsScanner.php index f120596d..503c090f 100644 --- a/src/Utils/FunctionsScanner.php +++ b/src/Utils/FunctionsScanner.php @@ -70,7 +70,7 @@ public function saveGettextFunctions($translations, array $options) continue; } - if (!$isDefaultDomain && !$domainTranslations) { + if (!$domainTranslations) { continue; } diff --git a/tests/AssetsTest.php b/tests/AssetsTest.php index 1aad6fd2..d448ddd5 100644 --- a/tests/AssetsTest.php +++ b/tests/AssetsTest.php @@ -548,6 +548,15 @@ public function testVueJs2MultipleDomainScanning() } } + public function testMissingDomainScanWithOtherStringsInFile() + { + $translations = (new Translations())->setDomain('unknown-domain'); + + PhpCode::fromFileMultiple(static::asset('phpcode6/input.php'), [$translations]); + + self::assertCount(0, $translations); + } + public function testXliffUnitIds() { $translations = static::get('xliff/Xliff', 'Xliff', ['unitid_as_id' => true]); @@ -580,6 +589,6 @@ public function testXliffUnitIds() // Converting from an XLIFF that contains duplicate elements // to a PO file will result in the loss of the duplicates. - $this->runTestFormat('xliff/Po', $countTranslations-1, $countTranslated-1, $countHeaders); + $this->runTestFormat('xliff/Po', $countTranslations - 1, $countTranslated - 1, $countHeaders); } } diff --git a/tests/assets/phpcode6/input.php b/tests/assets/phpcode6/input.php new file mode 100644 index 00000000..2782837f --- /dev/null +++ b/tests/assets/phpcode6/input.php @@ -0,0 +1,6 @@ +