]> scripts.mit.edu Git - autoinstallsdev/mediawiki.git/blobdiff - tests/phpunit/includes/shell/CommandFactoryTest.php
MediaWiki 1.30.2
[autoinstallsdev/mediawiki.git] / tests / phpunit / includes / shell / CommandFactoryTest.php
diff --git a/tests/phpunit/includes/shell/CommandFactoryTest.php b/tests/phpunit/includes/shell/CommandFactoryTest.php
new file mode 100644 (file)
index 0000000..aacfd43
--- /dev/null
@@ -0,0 +1,33 @@
+<?php
+
+use MediaWiki\Shell\CommandFactory;
+use Psr\Log\NullLogger;
+use Wikimedia\TestingAccessWrapper;
+
+/**
+ * @group Shell
+ */
+class CommandFactoryTest extends PHPUnit_Framework_TestCase {
+       /**
+        * @covers MediaWiki\Shell\CommandFactory::create
+        */
+       public function testCreate() {
+               $logger = new NullLogger();
+               $cgroup = '/sys/fs/cgroup/memory/mygroup';
+               $limits = [
+                       'filesize' => 1000,
+                       'memory' => 1000,
+                       'time' => 30,
+                       'walltime' => 40,
+               ];
+
+               $factory = new CommandFactory( $limits, $cgroup );
+               $factory->setLogger( $logger );
+               $command = $factory->create();
+
+               $wrapper = TestingAccessWrapper::newFromObject( $command );
+               $this->assertSame( $logger, $wrapper->logger );
+               $this->assertSame( $cgroup, $wrapper->cgroup );
+               $this->assertSame( $limits, $wrapper->limits );
+       }
+}