TranslationStashStorageTest.php

Go to the documentation of this file.
00001 <?php
00011 class TranslationStashStorageTest extends MediaWikiTestCase {
00012 
00013     public function testAdd() {
00014         $storage = new TranslationStashStorage( wfGetDB( DB_MASTER ) );
00015 
00016         $translation1 = new StashedTranslation(
00017             User::newFromId( 1 ),
00018             Title::makeTitle( NS_MAIN, __METHOD__ ),
00019             'test value',
00020             array( 'kissa', 'kala' )
00021         );
00022 
00023         $translation2 = new StashedTranslation(
00024             User::newFromId( 2 ),
00025             Title::makeTitle( NS_MAIN, __METHOD__ ),
00026             'test value 2',
00027             array( 'kissa', 'kala' )
00028         );
00029 
00030         $storage->addTranslation( $translation1 );
00031         $storage->addTranslation( $translation2 );
00032 
00033         $ret = $storage->getTranslations( User::newFromId( 1 ) );
00034         $this->assertCount( 1, $ret, 'One stashed translation for this user' );
00035 
00036         // AssertSame required same reference, assert equals only same content
00037         $this->assertEquals( $translation1, $ret[0], 'Data roundtrips' );
00038     }
00039 }
Generated on Tue Oct 29 00:00:24 2013 for MediaWiki Translate Extension by  doxygen 1.6.3