function testSaveUpdateDelete()
 {
     $backup = './messages/messages_mysql.sql';
     $source = MessageSource::factory($this->type, $this->source);
     $source->setCulture('en_AU');
     $source->setCache(new MessageCache('./tmp'));
     //restore using the back file
     $this->restore($backup, $source->connection());
     //test that the back file doesn't contain the 'Testing123' string.
     $contents = $this->getAllContents($source->connection());
     $this->assertNoUnwantedPattern('/Testing123/', $contents);
     $formatter = new MessageFormat($source);
     $formatter->setUntranslatedPS(array('[t]', '[/t]'));
     //add a untranslated string
     $this->assertEqual($formatter->format('Testing123'), '[t]Testing123[/t]');
     //save it
     $this->assertTrue($formatter->getSource()->save());
     //check the contents
     $contents = $this->getAllContents($source->connection());
     $this->assertWantedPattern('/Testing123/', $contents);
     //testing for update.
     $this->assertTrue($formatter->getSource()->update('Testing123', '123Test', 'update comments'));
     $contents = $this->getAllContents($source->connection());
     $this->assertWantedPattern('/123Test/', $contents);
     $this->assertWantedPattern('/update comments/', $contents);
     //var_dump(htmlspecialchars($contents));
     //now doing some delete
     //doesn't detect missing source
     $this->assertFalse($formatter->getSource()->delete('Test123'));
     $this->assertTrue($formatter->getSource()->delete('Testing123'));
     $contents = $this->getAllContents($source->connection());
     $this->assertNoUnwantedPattern('/Testing123/', $contents);
     //restore using the backup file.
     $this->restore($backup, $source->connection());
 }
 function test1()
 {
     $source = MessageSource::factory($this->type, $this->source);
     $source->setCulture('en_AU');
     $source->setCache(new MessageCache('./tmp'));
     $formatter = new MessageFormat($source);
     $this->assertEqual($formatter->format('Hello'), 'G\'day Mate!');
     $this->assertEqual($formatter->format('Goodbye'), 'Goodbye');
     $formatter->setUntranslatedPS(array('[T]', '[/T]'));
     $this->assertEqual($formatter->format('Hi'), '[T]Hi[/T]');
     //save the untranslated
 }