setMwGlobals( [ // Run with the default useBundled=true 'wgPygmentizePath' => false, // Silence wfWarn for the expected Shellbox error 'wgDevelopmentWarnings' => false, ] ); } private function stubShellbox( ?BoxedResult $result, ?Exception $e ) { $factory = $this->createStub( CommandFactory::class ); $command = new class ( $result, $e ) extends BoxedCommand { private $result; private $e; public function __construct( $result, $e ) { $this->result = $result; $this->e = $e; } public function execute(): BoxedResult { if ( $this->e ) { throw $this->e; } return $this->result; } }; $factory->method( 'createBoxed' )->willReturn( $command ); $this->setService( 'ShellCommandFactory', $factory ); } public static function provideHighlight() { yield 'basic' => [ ( new BoxedResult ) ->stdout( '
x
"example"
"example"