diff options
Diffstat (limited to 'www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Unit/MediaWiki/Search/Form/SortFormTest.php')
-rw-r--r-- | www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Unit/MediaWiki/Search/Form/SortFormTest.php | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Unit/MediaWiki/Search/Form/SortFormTest.php b/www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Unit/MediaWiki/Search/Form/SortFormTest.php new file mode 100644 index 00000000..4040e1a9 --- /dev/null +++ b/www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Unit/MediaWiki/Search/Form/SortFormTest.php @@ -0,0 +1,57 @@ +<?php + +namespace SMW\Tests\MediaWiki\Search\Form; + +use SMW\MediaWiki\Search\Form\SortForm; + +/** + * @covers \SMW\MediaWiki\Search\Form\SortForm + * @group semantic-mediawiki + * + * @license GNU GPL v2+ + * @since 3.0 + * + * @author mwjames + */ +class SortFormTest extends \PHPUnit_Framework_TestCase { + + private $webRequest; + + protected function setUp() { + + $this->webRequest = $this->getMockBuilder( '\WebRequest' ) + ->disableOriginalConstructor() + ->getMock(); + } + + public function testCanConstruct() { + + $this->assertInstanceOf( + SortForm::class, + new SortForm( $this->webRequest ) + ); + } + + public function testMakeFields() { + + $this->webRequest->expects( $this->at( 0 ) ) + ->method( 'getVal' ) + ->with( $this->equalTo( 'sort' ) ) + ->will( $this->returnValue( 'Foo' ) ); + + $instance = new SortForm( + $this->webRequest + ); + + $this->assertContains( + 'smw-search-sort', + $instance->makeFields( [] ) + ); + + $this->assertEquals( + [ 'sort' => 'Foo' ], + $instance->getParameters() + ); + } + +} |