diff options
Diffstat (limited to 'www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Unit/Utils/ErrorCodeFormatterTest.php')
-rw-r--r-- | www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Unit/Utils/ErrorCodeFormatterTest.php | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Unit/Utils/ErrorCodeFormatterTest.php b/www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Unit/Utils/ErrorCodeFormatterTest.php new file mode 100644 index 00000000..41eee654 --- /dev/null +++ b/www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Unit/Utils/ErrorCodeFormatterTest.php @@ -0,0 +1,48 @@ +<?php + +namespace SMW\Tests\Utils; + +use SMW\Utils\ErrorCodeFormatter; + +/** + * @covers \SMW\Utils\ErrorCodeFormatter + * @group semantic-mediawiki + * + * @license GNU GPL v2+ + * @since 2.5 + * + * @author mwjames + */ +class ErrorCodeFormatterTest extends \PHPUnit_Framework_TestCase { + + public function testGetStringFromJsonErrorCode() { + + $this->assertInternalType( + 'string', + ErrorCodeFormatter::getStringFromJsonErrorCode( 'Foo' ) + ); + + $contents = json_decode( '{ Foo: Bar }' ); + + $this->assertInternalType( + 'string', + ErrorCodeFormatter::getStringFromJsonErrorCode( json_last_error() ) + ); + } + + public function testGetMessageFromJsonErrorCode() { + + $this->assertInternalType( + 'string', + ErrorCodeFormatter::getMessageFromJsonErrorCode( 'Foo' ) + ); + + $contents = json_decode( '{ Foo: Bar }' ); + + $this->assertInternalType( + 'string', + ErrorCodeFormatter::getMessageFromJsonErrorCode( json_last_error() ) + ); + } + +} |