diff options
Diffstat (limited to 'www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Unit/ParametersTest.php')
-rw-r--r-- | www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Unit/ParametersTest.php | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Unit/ParametersTest.php b/www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Unit/ParametersTest.php new file mode 100644 index 00000000..7cf3b3d1 --- /dev/null +++ b/www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Unit/ParametersTest.php @@ -0,0 +1,52 @@ +<?php + +namespace SMW\Tests; + +use SMW\Parameters; + +/** + * @covers \SMW\Parameters + * @group semantic-mediawiki + * + * @license GNU GPL v2+ + * @since 3.0 + * + * @author mwjames + */ +class ParametersTest extends \PHPUnit_Framework_TestCase { + + use PHPUnitCompat; + + public function testCanConstruct() { + + $this->assertInstanceOf( + Parameters::class, + new Parameters() + ); + } + + public function testAddOption() { + + $instance = new Parameters(); + + $this->assertFalse( + $instance->has( 'Foo' ) + ); + + $instance->set( 'Foo', 42 ); + + $this->assertEquals( + 42, + $instance->get( 'Foo' ) + ); + } + + public function testUnregisteredKeyThrowsException() { + + $instance = new Parameters(); + + $this->setExpectedException( 'InvalidArgumentException' ); + $instance->get( 'Foo' ); + } + +} |