jenkins-bot has submitted this change and it was merged.
Change subject: Adding test for setAllAliases
......................................................................
Adding test for setAllAliases
Change-Id: I0df64b8125073f4cb24d26b228a86839ae8dbf1e
---
M tests/phpunit/Entity/EntityTest.php
1 file changed, 33 insertions(+), 0 deletions(-)
Approvals:
Daniel Kinzler: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/phpunit/Entity/EntityTest.php
b/tests/phpunit/Entity/EntityTest.php
index 458bb69..e21da9b 100644
--- a/tests/phpunit/Entity/EntityTest.php
+++ b/tests/phpunit/Entity/EntityTest.php
@@ -263,6 +263,39 @@
/**
* @dataProvider aliasesProvider
*/
+ public function testSetAllAliases( array $aliasesLists ) {
+
+ $entity = $this->getNewEmpty();
+ $entity->addAliases( 'zh' , array( 'qwertyuiop123' ,
'321poiuytrewq' ) );
+
+ $aliasesToSet = array();
+ foreach ( $aliasesLists as $langCode => $aliasesList ) {
+ foreach ( $aliasesList as $aliases ) {
+ $aliasesToSet[$langCode]= $aliases;
+ }
+ }
+
+ $entity->setAllAliases( $aliasesToSet );
+
+ foreach ( $aliasesLists as $langCode => $aliasesList ) {
+ $expected = array_values( array_unique( array_pop(
$aliasesList ) ) );
+ asort( $aliasesList );
+
+ $actual = $entity->getAliases( $langCode );
+ asort( $actual );
+
+ $this->assertEquals( $expected, $actual );
+ }
+
+ foreach ( $entity->getAllAliases() as $langCode => $aliasesList
) {
+ $this->assertEquals( $aliasesList , array_unique(
$aliasesToSet[$langCode] ) );
+ }
+
+ }
+
+ /**
+ * @dataProvider aliasesProvider
+ */
public function testGetAliases( array $aliasesLists ) {
$entity = $this->getNewEmpty();
--
To view, visit https://gerrit.wikimedia.org/r/73974
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I0df64b8125073f4cb24d26b228a86839ae8dbf1e
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/WikibaseDataModel
Gerrit-Branch: master
Gerrit-Owner: Addshore <[email protected]>
Gerrit-Reviewer: Daniel Kinzler <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits