filesystemMock ->expects($this->once()) ->method('rm') ->with(BP . '/' . ProfilerDisableCommand::PROFILER_FLAG_FILE); $this->filesystemMock ->expects($this->once()) ->method('fileExists') ->with(BP . '/' . ProfilerDisableCommand::PROFILER_FLAG_FILE) ->willReturn($fileExists); /** @var ProfilerDisableCommand $command */ $command = new ProfilerDisableCommand($this->filesystemMock); $commandTester = new CommandTester($command); $commandTester->execute([]); self::assertEquals( $expectedOutput, trim(str_replace(PHP_EOL, ' ', $commandTester->getDisplay())) ); } /** * Data provider for testCommand. * * @return array */ public function commandDataProvider() { return [ [true, 'Something went wrong while disabling the profiler.'], [false, 'Profiler disabled.'], ]; } /** * @inheritdoc */ protected function setUp() { $this->filesystemMock = $this->getMockBuilder(File::class) ->disableOriginalConstructor() ->getMock(); } }