+/**
+ * Small test suite to confirm proper functionality of the utilities and
+ * initializations in this file.
+ */
+var envExecCount = 0;
+module( 'mediawiki.tests.qunit.testrunner', QUnit.newMwEnvironment({
+ setup: function () {
+ envExecCount += 1;
+ this.mwHtmlLive = mw.html;
+ mw.html = {
+ escape: function () {
+ return 'mocked-' + envExecCount;
+ }
+ };
+ },
+ teardown: function () {
+ mw.html = this.mwHtmlLive;
+ },
+ config: {
+ testVar: 'foo'
+ },
+ messages: {
+ testMsg: 'Foo.'
+ }
+}) );
+
+test( 'Setup', function () {
+ expect( 3 );
+
+ equal( mw.html.escape( 'foo' ), 'mocked-1', 'extra setup() callback was ran.' );
+ equal( mw.config.get( 'testVar' ), 'foo', 'config object applied' );
+ equal( mw.messages.get( 'testMsg' ), 'Foo.', 'messages object applied' );
+
+ mw.config.set( 'testVar', 'bar' );
+ mw.messages.set( 'testMsg', 'Bar.' );
+});
+
+test( 'Teardown', function () {
+ expect( 3 );
+
+ equal( mw.html.escape( 'foo' ), 'mocked-2', 'extra setup() callback was re-ran.' );
+ equal( mw.config.get( 'testVar' ), 'foo', 'config object restored and re-applied after test()' );
+ equal( mw.messages.get( 'testMsg' ), 'Foo.', 'messages object restored and re-applied after test()' );
+});
+
+module( 'mediawiki.tests.qunit.testrunner-after', QUnit.newMwEnvironment() );
+
+test( 'Teardown', function () {
+ expect( 3 );
+
+ equal( mw.html.escape( '<' ), '<', 'extra teardown() callback was ran.' );
+ equal( mw.config.get( 'testVar' ), null, 'config object restored to live in next module()' );
+ equal( mw.messages.get( 'testMsg' ), null, 'messages object restored to live in next module()' );
+});
+