<?php
-class UIDGeneratorTest extends MediaWikiTestCase {
+class UIDGeneratorTest extends PHPUnit_Framework_TestCase {
+
+ protected function tearDown() {
+ // Bug: 44850
+ UIDGenerator::unitTestTearDown();
+ parent::tearDown();
+ }
/**
* @dataProvider provider_testTimestampedUID
$lastId = array_shift( $ids );
- $this->assertArrayEquals( array_unique( $ids ), $ids, "All generated IDs are unique." );
+ $this->assertSame( array_unique( $ids ), $ids, "All generated IDs are unique." );
foreach ( $ids as $id ) {
$id_bin = wfBaseConvert( $id, 10, 2 );
$lastId_bin = wfBaseConvert( $lastId, 10, 2 );
$this->assertGreaterThanOrEqual(
- substr( $id_bin, 0, $tbits ),
substr( $lastId_bin, 0, $tbits ),
+ substr( $id_bin, 0, $tbits ),
"New ID timestamp ($id_bin) >= prior one ($lastId_bin)." );
if ( $hostbits ) {
$this->assertEquals(
- substr( $id_bin, 0, -$hostbits ),
- substr( $lastId_bin, 0, -$hostbits ),
+ substr( $id_bin, -$hostbits ),
+ substr( $lastId_bin, -$hostbits ),
"Host ID of ($id_bin) is same as prior one ($lastId_bin)." );
}
$id1 = UIDGenerator::newSequentialPerNodeID( 'test', 32 );
$id2 = UIDGenerator::newSequentialPerNodeID( 'test', 32 );
- $this->assertType( 'float', $id1, "ID returned as float" );
- $this->assertType( 'float', $id2, "ID returned as float" );
+ $this->assertInternalType( 'float', $id1, "ID returned as float" );
+ $this->assertInternalType( 'float', $id2, "ID returned as float" );
$this->assertGreaterThan( 0, $id1, "ID greater than 1" );
$this->assertGreaterThan( $id1, $id2, "IDs increasing in value" );
}
$ids = UIDGenerator::newSequentialPerNodeIDs( 'test', 32, 5 );
$lastId = null;
foreach ( $ids as $id ) {
- $this->assertType( 'float', $id, "ID returned as float" );
+ $this->assertInternalType( 'float', $id, "ID returned as float" );
$this->assertGreaterThan( 0, $id, "ID greater than 1" );
if ( $lastId ) {
$this->assertGreaterThan( $lastId, $id, "IDs increasing in value" );