summaryrefslogtreecommitdiff
path: root/www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Unit/Utils/TimerTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Unit/Utils/TimerTest.php')
-rw-r--r--www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Unit/Utils/TimerTest.php49
1 files changed, 49 insertions, 0 deletions
diff --git a/www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Unit/Utils/TimerTest.php b/www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Unit/Utils/TimerTest.php
new file mode 100644
index 00000000..41e7ca30
--- /dev/null
+++ b/www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Unit/Utils/TimerTest.php
@@ -0,0 +1,49 @@
+<?php
+
+namespace SMW\Tests\Utils;
+
+use SMW\Utils\Timer;
+
+/**
+ * @covers \SMW\Utils\Timer
+ * @group semantic-mediawiki
+ *
+ * @license GNU GPL v2+
+ * @since 2.5
+ *
+ * @author mwjames
+ */
+class TimerTest extends \PHPUnit_Framework_TestCase {
+
+ public function testGetElapsedTime() {
+
+ Timer::start( __CLASS__ );
+
+ $this->assertInternalType(
+ 'float',
+ Timer::getElapsedTime( __CLASS__ )
+ );
+
+ $this->assertInternalType(
+ 'float',
+ Timer::getElapsedTime( __CLASS__, 5 )
+ );
+ }
+
+ public function testGetElapsedTimeWithoutStart() {
+
+ $this->assertEquals(
+ 0,
+ Timer::getElapsedTime( 'Foo' )
+ );
+ }
+
+ public function testGetElapsedTimeAsLoggableMessage() {
+
+ $this->assertInternalType(
+ 'string',
+ Timer::getElapsedTimeAsLoggableMessage( 'Foo' )
+ );
+ }
+
+}