MediaWiki REL1_33
CommandFactoryTest.php
Go to the documentation of this file.
1<?php
2
8
12class CommandFactoryTest extends PHPUnit\Framework\TestCase {
13
14 use MediaWikiCoversValidator;
15
19 public function testCreate() {
20 $logger = new NullLogger();
21 $cgroup = '/sys/fs/cgroup/memory/mygroup';
22 $limits = [
23 'filesize' => 1000,
24 'memory' => 1000,
25 'time' => 30,
26 'walltime' => 40,
27 ];
28
29 $factory = new CommandFactory( $limits, $cgroup, false );
30 $factory->setLogger( $logger );
31 $factory->logStderr();
32 $command = $factory->create();
33 $this->assertInstanceOf( Command::class, $command );
34
35 $wrapper = TestingAccessWrapper::newFromObject( $command );
36 $this->assertSame( $logger, $wrapper->logger );
37 $this->assertSame( $cgroup, $wrapper->cgroup );
38 $this->assertSame( $limits, $wrapper->limits );
39 $this->assertTrue( $wrapper->doLogStderr );
40 }
41
45 public function testFirejailCreate() {
46 $factory = new CommandFactory( [], false, 'firejail' );
47 $factory->setLogger( new NullLogger() );
48 $this->assertInstanceOf( FirejailCommand::class, $factory->create() );
49 }
50}
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
$command
Definition cdb.php:65
testCreate()
MediaWiki\Shell\CommandFactory::create.
testFirejailCreate()
MediaWiki\Shell\CommandFactory::create.
Factory facilitating dependency injection for Command.
Class used for executing shell commands.
Definition Command.php:35
Restricts execution of shell commands using firejail.