public function testPOAnnotationsWriting() { // Test flag utilities. $comment = ''; $this->assertEquals(tao_helpers_translation_POUtils::addFlag($comment, 'tao-public'), 'tao-public'); $comment = 'no-error test-flag'; $this->assertEquals(tao_helpers_translation_POUtils::addFlag($comment, 'tao-public'), 'no-error test-flag tao-public'); $comment = 'foo bar code'; $this->assertEquals(tao_helpers_translation_POUtils::addFlag($comment, 'bar '), 'foo bar code'); // Test PO comments serialization. $annotations = array(tao_helpers_translation_POTranslationUnit::TRANSLATOR_COMMENTS => 'A single line translator comment.'); $comment = '# A single line translator comment.'; $this->assertEquals(tao_helpers_translation_POUtils::serializeAnnotations($annotations), $comment); $annotations = array(tao_helpers_translation_POTranslationUnit::TRANSLATOR_COMMENTS => "A multi line translator comment...\nWith a second line.", tao_helpers_translation_POTranslationUnit::EXTRACTED_COMMENTS => "An extracted comment.", tao_helpers_translation_POTranslationUnit::FLAGS => "tao-public foo-bar-code php-format"); $comment = "# A multi line translator comment...\n# With a second line.\n#. An extracted comment.\n#, tao-public foo-bar-code php-format"; $this->assertEquals(tao_helpers_translation_POUtils::serializeAnnotations($annotations), $comment); $annotations = array(tao_helpers_translation_POTranslationUnit::FLAGS => "tao-public"); $comment = "#, tao-public"; $this->assertEquals(tao_helpers_translation_POUtils::serializeAnnotations($annotations), $comment); }