/** * @test * @covers Cocur\Bundle\BuildBundle\Command\CleanCommand::__construct() * @covers Cocur\Bundle\BuildBundle\Command\CleanCommand::configure() * @covers Cocur\Bundle\BuildBundle\Command\CleanCommand::execute() * @covers Cocur\Bundle\BuildBundle\Command\CleanCommand::cleanDirectory() */ public function executeShouldOutputDetailedInformationInVerboseMode() { $this->buildDir->addChild(vfsStream::newFile('foo1.txt')); $this->buildDir->addChild($barDir = vfsStream::newDirectory('bar')); $barDir->addChild(vfsStream::newFile('foo2.txt')); $this->filesystem->shouldReceive('remove')->with(sprintf('%s/foo1.txt', $this->buildDir->url()))->once(); $this->filesystem->shouldReceive('remove')->with(sprintf('%s/bar/foo2.txt', $this->buildDir->url()))->once(); $this->filesystem->shouldReceive('remove')->with(sprintf('%s/bar', $this->buildDir->url()))->once(); $command = $this->application->find('cocur:clean'); $commandTester = new CommandTester($command); $commandTester->execute(['command' => $command->getName()], ['verbosity' => 2]); $this->assertRegExp('/Delete:(.*)foo1\\.txt/', $commandTester->getDisplay()); $this->assertRegExp('/Delete:(.*)bar/', $commandTester->getDisplay()); $this->assertRegExp('/Delete:(.*)bar\\/foo2\\.txt/', $commandTester->getDisplay()); $this->assertRegExp('/Removed 3 files from/', $commandTester->getDisplay()); }