Merge "Additional tests to keep Parsoid on track."
[lhc/web/wiklou.git] / tests / phpunit / includes / SeleniumConfigurationTest.php
index fa0ea80..8f6aafa 100644 (file)
@@ -1,14 +1,14 @@
 <?php
 
-class SeleniumConfigurationTest extends PHPUnit_Framework_TestCase {
+class SeleniumConfigurationTest extends MediaWikiTestCase {
 
-       /*
+       /**
         * The file where the test temporarity stores the selenium config.
         * This should be cleaned up as part of teardown.
         */
        private $tempFileName;
 
-       /*
+       /**
         * String containing the a sample selenium settings
         */
        private $testConfig0 =
@@ -32,14 +32,14 @@ runAgainstGrid      = false
 testSuite[SimpleSeleniumTestSuite] = "tests/selenium/SimpleSeleniumTestSuite.php"
 testSuite[TestSuiteName] = "testSuitePath"
 ';
-       /*
+       /**
         * Array of expected browsers from $testConfig0
         */
        private $testBrowsers0 = array( 'firefox' => '*firefox',
                                                        'iexplorer' => '*iexploreproxy',
                                                        'chrome' => '*chrome'
        );
-       /*
+       /**
         * Array of expected selenium settings from $testConfig0
         */
        private $testSettings0 = array(
@@ -55,7 +55,7 @@ testSuite[TestSuiteName] = "testSuitePath"
                'jUnitLogFile' => null,
                'runAgainstGrid' => null
        );
-       /*
+       /**
         * Array of expected testSuites from $testConfig0
         */
        private $testSuites0 = array(
@@ -64,7 +64,7 @@ testSuite[TestSuiteName] = "testSuitePath"
        );
 
 
-       /*
+       /**
         * Another sample selenium settings file contents
         */
        private $testConfig1 =
@@ -73,11 +73,11 @@ testSuite[TestSuiteName] = "testSuitePath"
 host                           = "localhost"
 testBrowser            = "firefox"
 ';
-       /*
+       /**
         * Expected browsers from $testConfig1
         */
        private $testBrowsers1 = null;
-       /*
+       /**
         * Expected selenium settings from $testConfig1
         */
        private $testSettings1 = array(
@@ -93,22 +93,23 @@ testBrowser                 = "firefox"
                'jUnitLogFile' => null,
                'runAgainstGrid' => null
        );
-       /*
+       /**
         * Expected test suites from $testConfig1
         */
        private $testSuites1 = null;
 
 
-       public function setUp() {
+       protected function setUp() {
+               parent::setUp();
                if ( !defined( 'SELENIUMTEST' ) ) {
                        define( 'SELENIUMTEST', true );
                }
        }
 
-       /*
+       /**
         * Clean up the temporary file used to store the selenium settings.
         */
-       public function tearDown() {
+       protected function tearDown() {
                if ( strlen( $this->tempFileName ) > 0 ) {
                        unlink( $this->tempFileName );
                        unset( $this->tempFileName );
@@ -121,9 +122,9 @@ testBrowser                 = "firefox"
         * @group SeleniumFramework
         */
        public function testErrorOnIncorrectConfigFile() {
-               $seleniumSettings;
-               $seleniumBrowsers;
-               $seleniumTestSuites;
+               $seleniumSettings = array();
+               $seleniumBrowsers = array();
+               $seleniumTestSuites = array();
 
                SeleniumConfig::getSeleniumSettings($seleniumSettings,
                        $seleniumBrowsers,
@@ -137,9 +138,9 @@ testBrowser                 = "firefox"
         * @group SeleniumFramework
         */
        public function testErrorOnMissingConfigFile() {
-               $seleniumSettings;
-               $seleniumBrowsers;
-               $seleniumTestSuites;
+               $seleniumSettings = array();
+               $seleniumBrowsers = array();
+               $seleniumTestSuites = array();
                global $wgSeleniumConfigFile;
                $wgSeleniumConfigFile = '';
                SeleniumConfig::getSeleniumSettings($seleniumSettings,
@@ -151,9 +152,9 @@ testBrowser                 = "firefox"
         * @group SeleniumFramework
         */
        public function testUsesGlobalVarForConfigFile() {
-               $seleniumSettings;
-               $seleniumBrowsers;
-               $seleniumTestSuites;
+               $seleniumSettings = array();
+               $seleniumBrowsers = array();
+               $seleniumTestSuites = array();
                global $wgSeleniumConfigFile;
                $this->writeToTempFile( $this->testConfig0 );
                $wgSeleniumConfigFile = $this->tempFileName;
@@ -177,9 +178,9 @@ testBrowser                 = "firefox"
         */
        public function testgetSeleniumSettings($sampleConfig, $expectedSettings, $expectedBrowsers, $expectedSuites ) {
                $this->writeToTempFile( $sampleConfig );
-               $seleniumSettings;
-               $seleniumBrowsers;
-               $seleniumTestSuites;
+               $seleniumSettings = array();
+               $seleniumBrowsers = array();
+               $seleniumTestSuites = null;
 
                SeleniumConfig::getSeleniumSettings($seleniumSettings,
                        $seleniumBrowsers,
@@ -199,7 +200,7 @@ testBrowser                 = "firefox"
 
        }
 
-       /*
+       /**
         * create a temp file and write text to it.
         * @param $testToWrite the text to write to the temp file
         */
@@ -210,7 +211,7 @@ testBrowser                 = "firefox"
                fclose($tempFile);
        }
 
-       /*
+       /**
         * Returns an array containing:
         *      The contents of the selenium cingiguration ini file
         *  The expected selenium configuration array that getSeleniumSettings should return