/** * Test outputTypeChoices method * * @return void */ public function testOutputTypeChoices() { $this->io->expects($this->at(0))->method('out')->with($this->stringContains('You must provide')); $this->io->expects($this->at(1))->method('out')->with($this->stringContains('1. Entity')); $this->io->expects($this->at(2))->method('out')->with($this->stringContains('2. Table')); $this->io->expects($this->at(3))->method('out')->with($this->stringContains('3. Controller')); $this->Task->outputTypeChoices(); }
/** * Test that baking a plugin for a project that contains a composer.json, the later * will be updated * * @return void */ public function testMainUpdateComposer() { $this->Task->expects($this->at(0))->method('in')->will($this->returnValue('y')); $this->io->expects($this->any())->method('askChoice')->will($this->returnValue('y')); $this->Task->expects($this->any())->method('findComposer')->will($this->returnValue('composer.phar')); $file = TMP . 'tests' . DS . 'main-composer.json'; file_put_contents($file, '{}'); $savePath = $this->Task->path; $this->Task->path = ROOT . DS . 'tests' . DS . 'BakedPlugins/'; $this->Task->expects($this->any())->method('_rootComposerFilePath')->will($this->returnValue($file)); $this->Task->expects($this->once())->method('callProcess')->with('php ' . escapeshellarg('composer.phar') . ' dump-autoload'); $this->Task->main('ComposerExample'); $result = file_get_contents($file); $this->assertSameAsFile(__FUNCTION__ . '.json', $result); $folder = new Folder($this->Task->path); $folder->delete(); $this->Task->path = $savePath; }