Use MediaWikiCoversValidator for tests that don't use MediaWikiTestCase
[lhc/web/wiklou.git] / tests / phpunit / includes / shell / CommandTest.php
index 81fae33..2bafa03 100644 (file)
@@ -1,11 +1,16 @@
 <?php
 
 use MediaWiki\Shell\Command;
+use Wikimedia\TestingAccessWrapper;
 
 /**
+ * @covers \MediaWiki\Shell\Command
  * @group Shell
  */
 class CommandTest extends PHPUnit_Framework_TestCase {
+
+       use MediaWikiCoversValidator;
+
        private function requirePosix() {
                if ( wfIsWindows() ) {
                        $this->markTestSkipped( 'This test requires a POSIX environment.' );
@@ -103,6 +108,16 @@ class CommandTest extends PHPUnit_Framework_TestCase {
                $this->assertRegExp( '/^.+no-such-file.*$/m', $result->getStderr() );
        }
 
+       /**
+        * Test that null values are skipped by params() and unsafeParams()
+        */
+       public function testNullsAreSkipped() {
+               $command = TestingAccessWrapper::newFromObject( new Command );
+               $command->params( 'echo', 'a', null, 'b' );
+               $command->unsafeParams( 'c', null, 'd' );
+               $this->assertEquals( "'echo' 'a' 'b' c d", $command->command );
+       }
+
        public function testT69870() {
                $commandLine = wfIsWindows()
                        // 333 = 331 + CRLF