setCode changes the language code for the Language object but it also
replaces the whole language codes for all Language objects.
> $lang = Language::factory( 'fr' )
> $lang2 = Language::factory( 'fr' )
> $lang->setCode( 'it' )
> print $lang2->getCode()
it
> $lang3 = Language::factory( 'fr' )
> print $lang3->getCode()
it
Better assign a new Language object.
Also add more tests for Language::equals.
Depends-On: I61439bac82021344c3f9a6056cccd937b3450af2
Depends-On: I2d9e551d6eb33f28f42aeaf48160eba21b83881f
Change-Id: I201b479f58e63c9c40fb8a3ec9575a551fb35235
* Class LegacyFormatter is deprecated.
* Use of CommentStore::insertWithTempTable() with 'img_description' is
deprecated. Use CommentStore::insert() instead.
* Class LegacyFormatter is deprecated.
* Use of CommentStore::insertWithTempTable() with 'img_description' is
deprecated. Use CommentStore::insert() instead.
+* Language::setCode is deprecated as public function. Use Language::factory
+ to create a new Language object with a different language code.
=== Other changes in 1.32 ===
* (T198811) The following tables have had their UNIQUE indexes turned into
=== Other changes in 1.32 ===
* (T198811) The following tables have had their UNIQUE indexes turned into
/**
* @param string $code
/**
* @param string $code
+ * @deprecated since 1.32, use Language::factory to create a new object instead.
*/
public function setCode( $code ) {
$this->mCode = $code;
*/
public function setCode( $code ) {
$this->mCode = $code;
* @covers Language::equals
*/
public function testEquals() {
* @covers Language::equals
*/
public function testEquals() {
- $en1 = new Language();
- $en1->setCode( 'en' );
-
+ $en1 = Language::factory( 'en' );
$en2 = Language::factory( 'en' );
$en2 = Language::factory( 'en' );
- $en2->setCode( 'en' );
-
- $this->assertTrue( $en1->equals( $en2 ), 'en equals en' );
+ $en3 = new Language();
+ $this->assertTrue( $en1->equals( $en2 ), 'en1 equals en2' );
+ $this->assertTrue( $en2->equals( $en3 ), 'en2 equals en3' );
+ $this->assertTrue( $en3->equals( $en1 ), 'en3 equals en1' );
$fr = Language::factory( 'fr' );
$this->assertFalse( $en1->equals( $fr ), 'en not equals fr' );
$fr = Language::factory( 'fr' );
$this->assertFalse( $en1->equals( $fr ), 'en not equals fr' );
+
+ $ar1 = Language::factory( 'ar' );
+ $ar2 = new LanguageAr();
+ $this->assertTrue( $ar1->equals( $ar2 ), 'ar equals ar' );