public function testCleanPackages() { $args = self::$cleanCommand->parseArgs(new StringArgs('')); // The not-found package $this->packageManager->expects($this->once())->method('removePackage')->with('vendor/package3'); $expected = <<<EOF Removing vendor/package3 EOF; $this->assertSame(0, $this->handler->handleClean($args, $this->io)); $this->assertSame($expected, $this->io->fetchOutput()); $this->assertEmpty($this->io->fetchErrors()); }
protected function setUp() { $this->environment = $this->getMockBuilder('Puli\\Manager\\Api\\Environment\\ProjectEnvironment')->disableOriginalConstructor()->getMock(); $this->dispatcher = $this->getMock('Symfony\\Component\\EventDispatcher\\EventDispatcherInterface'); $this->puli = $this->getMock('Puli\\Manager\\Api\\Puli'); $this->rootPackageFileManager = $this->getMock('Puli\\Manager\\Api\\Package\\RootPackageFileManager'); $this->repo = $this->getMock('Puli\\Repository\\Api\\ResourceRepository'); $this->discovery = $this->getMock('Puli\\Discovery\\Api\\ResourceDiscovery'); $this->discoveryManager = $this->getMock('Puli\\Manager\\Api\\Discovery\\DiscoveryManager'); $this->packageManager = $this->getMock('Puli\\Manager\\Api\\Package\\PackageManager'); $this->plugin = new AssetPlugin(); $this->puli->expects($this->any())->method('getEnvironment')->willReturn($this->environment); $this->puli->expects($this->any())->method('getEventDispatcher')->willReturn($this->dispatcher); $this->puli->expects($this->any())->method('getRootPackageFileManager')->willReturn($this->rootPackageFileManager); $this->puli->expects($this->any())->method('getRepository')->willReturn($this->repo); $this->puli->expects($this->any())->method('getDiscovery')->willReturn($this->discovery); $this->puli->expects($this->any())->method('getDiscoveryManager')->willReturn($this->discoveryManager); $this->puli->expects($this->any())->method('getPackageManager')->willReturn($this->packageManager); $this->packageManager->expects($this->any())->method('getPackages')->willReturn(new PackageCollection()); }