/**
  * Tests Translation_File_Output->save()
  */
 public function testSave()
 {
     $container = new Translation_WordsContainer();
     $container->addWord(new Translation_Word('test1'));
     $container->addWord(new Translation_Word('test2"'));
     $container->addWord(new Translation_Word('test3\''));
     $this->Translation_File_Output->setTranslatableWordsContainer($container);
     $this->assertFalse(vfsStreamWrapper::getRoot()->hasChild('subdir1'));
     $this->Translation_File_Output->save();
     $this->assertTrue(vfsStreamWrapper::getRoot()->hasChild('subdir1'));
     $this->assertTrue(vfsStreamWrapper::getRoot()->getChild('subdir1')->hasChild('subdir2'));
     $this->assertTrue(vfsStreamWrapper::getRoot()->getChild('subdir1')->getChild('subdir2')->hasChild('test.js'));
     $file = vfsStreamWrapper::getRoot()->getChild('subdir1')->getChild('subdir2')->getChild('test.js');
     $this->assertNotEquals('', $file->getContent());
 }
 /**
  * Tests Translation_File_Output_JavaScript->generateContents
  */
 public function testGenerateContents()
 {
     $container = new Translation_WordsContainer();
     $container->addWord(new Translation_Word('test1'));
     $container->addWord(new Translation_Word('test2'));
     $container->addWord(new Translation_Word('test3'));
     $container->addWord(new Translation_Word('test4'));
     $container->addWord(new Translation_Word('test5'));
     $this->Translation_File_Output_JavaScript->setTranslatableWordsContainer($container);
     $this->assertEquals(1, preg_match('/\\(\\{(\\s+\'([^\']+)\'\\s:\\s\'\',?\\n)+\\}\\)/', $this->Translation_File_Output_JavaScript->generateContents()));
 }
 /**
  * Tests Translation_File_Output_Php->generateContents
  */
 public function testGenerateContents()
 {
     $container = new Translation_WordsContainer();
     $container->addWord(new Translation_Word('test1'));
     $container->addWord(new Translation_Word('test2'));
     $container->addWord(new Translation_Word('test3'));
     $container->addWord(new Translation_Word('test4'));
     $container->addWord(new Translation_Word('test5'));
     $this->Translation_File_Output_Php->setTranslatableWordsContainer($container);
     $this->assertEquals(1, preg_match('/<\\?php\\s+(_\\(\\"([^\\"]+)\\"\\);\\n)+\\s+\\?>/', $this->Translation_File_Output_Php->generateContents()));
 }
 /**
  * Tests Translation_WordsContainer->checkSpelling()
  */
 public function testCheckSpelling()
 {
     $this->Translation_WordsContainer->checkSpelling(new Translation_SpellChecker_Aspell());
     $this->assertTrue($this->Translation_WordsContainer->offsetGet('testWord')->getIsMisspelled());
 }