/** * @param string $skeleton * * @throws IOException */ private function writeSkeletonFile($skeleton) { $destination = $this->config->getDestination(); if (file_exists($destination) && !$this->config->allowOverwrite()) { throw new IOException('A PHIVE configuration file already exists. Use the "-force" switch to overwrite it.'); } file_put_contents($this->config->getDestination(), $skeleton); }
/** * @dataProvider allowOverwriteProvider * * @param bool $switch */ public function testAllowOverwrite($switch) { $this->cliOptionsProphecy->isSwitch('force')->willReturn($switch); $config = new SkelCommandConfig($this->cliOptionsProphecy->reveal(), '/tmp/'); $this->assertSame($switch, $config->allowOverwrite()); }