Matthias Mullie has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/270959

Change subject: Test UUID get*() to create() roundtrip
......................................................................

Test UUID get*() to create() roundtrip

Change-Id: Ifa2a7d8706fdab8c8259ebb60bde3b33af4d0c69
---
M tests/phpunit/Model/UUIDTest.php
1 file changed, 44 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow 
refs/changes/59/270959/1

diff --git a/tests/phpunit/Model/UUIDTest.php b/tests/phpunit/Model/UUIDTest.php
index ec9ca3b..2235e6e 100644
--- a/tests/phpunit/Model/UUIDTest.php
+++ b/tests/phpunit/Model/UUIDTest.php
@@ -159,4 +159,48 @@
        public function testCreateLowNumber() {
                $this->assertEquals( UUID::create( 10 )->getAlphadecimal(), 
'000000000000000a' );
        }
+
+       public static function uuidProvider()
+       {
+               return array(
+                       array( UUID::create() ),
+                       array( UUID::getComparisonUUID( 1 ) ),
+               );
+       }
+
+       /**
+        * @dataProvider uuidProvider
+        * @param UUID $uuid
+        */
+       public function testAlphadecimalRoundtrip( UUID $uuid )
+       {
+               $expect = $uuid->getAlphadecimal();
+               $new = UUID::create( $expect );
+
+               $this->assertEquals( $expect, $new->getAlphadecimal() );
+       }
+
+       /**
+        * @dataProvider uuidProvider
+        * @param UUID $uuid
+        */
+       public function testHexRoundtrip( UUID $uuid )
+       {
+               $expect = $uuid->getHex();
+               $new = UUID::create( $expect );
+
+               $this->assertEquals( $expect, $new->getHex() );
+       }
+
+       /**
+        * @dataProvider uuidProvider
+        * @param UUID $uuid
+        */
+       public function testBinaryRoundtrip( UUID $uuid )
+       {
+               $expect = $uuid->getBinary();
+               $new = UUID::create( $expect );
+
+               $this->assertEquals( $expect->fetch(), 
$new->getBinary()->fetch() );
+       }
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/270959
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifa2a7d8706fdab8c8259ebb60bde3b33af4d0c69
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Matthias Mullie <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to