shell: Demonstrate that ->restrict( RESTRICT_NONE ) is broken

Adds an intentionally failing test to demonstrate that calling
Command::restrict( Shell:RESTRICT_NONE ) is broken.

Bug: T257278
Change-Id: I0c305ae6ca8e5811f3c7b87ad5892985de19314c
This commit is contained in:
Kunal Mehta 2020-07-06 17:09:51 -07:00
parent 7b453ef90f
commit 3dc37a14af

View file

@ -1,6 +1,7 @@
<?php
use MediaWiki\Shell\Command;
use MediaWiki\Shell\Shell;
use Wikimedia\TestingAccessWrapper;
/**
@ -181,4 +182,17 @@ class CommandTest extends PHPUnit\Framework\TestCase {
$result = $command->execute();
$this->assertSame( '', $result->getStdout() );
}
/**
* @see T257278
* @group Broken
*/
public function testDisablingRestrictions() {
$command = TestingAccessWrapper::newFromObject( new Command() );
// As CommandFactory does for the firejail case:
$command->restrict( Shell::RESTRICT_DEFAULT );
// Disable restrictions
$command->restrict( Shell::RESTRICT_NONE );
$this->assertSame( 0, $command->restrictions );
}
}