diff options
Diffstat (limited to 'www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Unit/Schema/Content/HtmlBuilderTest.php')
-rw-r--r-- | www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Unit/Schema/Content/HtmlBuilderTest.php | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Unit/Schema/Content/HtmlBuilderTest.php b/www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Unit/Schema/Content/HtmlBuilderTest.php new file mode 100644 index 00000000..ef9706e1 --- /dev/null +++ b/www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Unit/Schema/Content/HtmlBuilderTest.php @@ -0,0 +1,104 @@ +<?php + +namespace SMW\Tests\Schema\Content; + +use SMW\Schema\Content\HtmlBuilder; +use SMW\Schema\Schema; + +/** + * @covers \SMW\Schema\Content\HtmlBuilder + * @group semantic-mediawiki + * + * @license GNU GPL v2+ + * @since 3.0 + * + * @author mwjames + */ +class HtmlBuilderTest extends \PHPUnit_Framework_TestCase { + + public function testCanConstruct() { + + $this->assertInstanceof( + HtmlBuilder::class, + new HtmlBuilder() + ); + } + + /** + * @dataProvider buildParamsProvider + */ + public function testBuild( $key, $params ) { + + $instance = new HtmlBuilder(); + + $this->assertInternalType( + 'string', + $instance->build( $key, $params ) + ); + } + + public function buildParamsProvider() { + + yield [ + 'schema_head', + [ + 'link' => 'Foo', + 'description' => 'bar', + 'schema-title' => '...', + 'error' => 'err---rr', + 'error-title' => 'error' + ] + ]; + + yield [ + 'schema_body', + [ + 'text' => 'Foo', + 'unknown_type' => 'bar' + ] + ]; + + yield [ + 'schema_error_text', + [ + 'list' => [], + 'schema' => 'Foo' + ] + ]; + + yield [ + 'schema_error', + [ + 'text' => '...', + 'msg' => 'Foo' + ] + ]; + + yield [ + 'schema_footer', + [ + 'href_type' => '...', + 'link_type' => 'Foo', + 'msg_type' => 'Bar', + 'tags' => [], + 'href_tag' => 'Foobar' + ] + ]; + + yield [ + 'schema_unknown_type', + [ + 'msg' => 'Foo' + ] + ]; + + yield [ + 'schema_help_link', + [ + 'href' => 'Foo' + ] + ]; + + } + +} |