/** * @depends testTranslation */ public function testPhpArrayGenerator($translations) { //Export to a file $filename = __DIR__ . '/files/tmp-phparray.php'; $result = Gettext\Generators\PhpArray::toFile($translations, $filename); $this->assertTrue($result); $this->assertTrue(is_file($filename)); //Load the data as an array $array = (include $filename); $this->assertTrue(is_array($array)); $this->assertArrayHasKey('messages', $array); //Load the data as translations object $translations2 = Gettext\Extractors\PhpArray::fromFile($filename); //Compare the length of the translations in the array an in the translations (the array always has one more message) $this->assertEquals(count($array['messages']) - 1, count($translations2)); unlink($filename); }