osInfo = $this->getMockBuilder(\Magento\Framework\OsInfo::class)->getMock(); } /** * @dataProvider commandPerOsTypeDataProvider * @param bool $isWindows * @param string $expectedResults */ public function testRender($isWindows, $expectedResults) { $this->osInfo->expects($this->once()) ->method('isWindows') ->will($this->returnValue($isWindows)); $commandRenderer = new CommandRendererBackground($this->osInfo); $this->assertEquals( $expectedResults, $commandRenderer->render($this->testCommand) ); } /** * Data provider for each os type * * @return array */ public function commandPerOsTypeDataProvider() { return [ 'windows' => [true, 'start /B "magento background task" ' . $this->testCommand . ' 2>&1'], 'unix' => [false, $this->testCommand . ' > /dev/null &'], ]; } }