summaryrefslogtreecommitdiff
path: root/www/wiki/extensions/SemanticFormsSelect/tests/phpunit/Unit/OutputTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'www/wiki/extensions/SemanticFormsSelect/tests/phpunit/Unit/OutputTest.php')
-rw-r--r--www/wiki/extensions/SemanticFormsSelect/tests/phpunit/Unit/OutputTest.php50
1 files changed, 50 insertions, 0 deletions
diff --git a/www/wiki/extensions/SemanticFormsSelect/tests/phpunit/Unit/OutputTest.php b/www/wiki/extensions/SemanticFormsSelect/tests/phpunit/Unit/OutputTest.php
new file mode 100644
index 00000000..7f124267
--- /dev/null
+++ b/www/wiki/extensions/SemanticFormsSelect/tests/phpunit/Unit/OutputTest.php
@@ -0,0 +1,50 @@
+<?php
+
+namespace SFS\Tests;
+
+use SFS\Output;
+
+/**
+ * @covers \SFS\Output
+ * @group semantic-forms-select
+ *
+ * @license GNU GPL v2+
+ * @since 1.3
+ *
+ * @author mwjames
+ */
+class OutputTest extends \PHPUnit_Framework_TestCase {
+ private $data;
+
+ protected function setUp() {
+ parent::setUp();
+ $this->data = [];
+ $this->data['Foo'] = 'Bar';
+ $this->data['Spam'] = 'Eggs';
+ }
+
+ protected function tearDown() {
+ unset( $this->data );
+ parent::tearDown();
+ }
+
+ public function testCanConstruct() {
+ $this->assertInstanceOf( '\SFS\Output', new Output() );
+ }
+
+ public function testAddToHeadItem() {
+ $ret = Output::addToHeadItem( $this->data );
+
+ $this->assertArrayHasKey( 'Foo', $ret );
+ $this->assertArrayHasKey( 'Spam', $ret );
+ }
+
+ public function testCommitToParserOutput() {
+ global $wgOut;
+ $expected_result = '[' . json_encode( $this->data ) . ']';
+ Output::commitToParserOutput();
+ $this->assertEquals(
+ $expected_result, $wgOut->getJsConfigVars()['sf_select']
+ );
+ }
+}