public function testCheckDir() { $fakeLocation = "/path/to/nowhere"; $config = new Composer(TEST_ROOT); $verifier = new ComposerChecks($config); $app['resources'] = $config; ResourceManager::$theApp = $app; // Check we get an exception if the directory isn't writable $this->php->expects($this->at(0))->method('is_dir')->will($this->returnValue(true)); $this->php->expects($this->at(1))->method('is_dir')->will($this->returnValue(true)); $this->php->expects($this->any())->method('is_writable')->will($this->returnValue(false)); $this->setExpectedException('Bolt\\Exception\\LowlevelException'); $this->expectOutputRegex("/Bolt - Fatal Error/"); $verifier->checkDir($fakeLocation); }
public function testCheckDir() { $fakeLocation = '/path/to/nowhere'; $config = new Composer(TEST_ROOT); $verifier = new ComposerChecks($config); $app['resources'] = $config; ResourceManager::$theApp = $app; // Check we get an exception if the directory isn't writable $this->php->expects($this->at(0))->method('is_dir')->will($this->returnValue(true)); $this->php->expects($this->at(1))->method('is_dir')->will($this->returnValue(true)); $this->php->expects($this->any())->method('is_writable')->will($this->returnValue(false)); try { $verifier->checkDir($fakeLocation); $this->fail('Bolt\\Exception\\LowlevelException not thrown'); } catch (LowlevelException $e) { $this->assertRegExp("/The default folder \\/path\\/to\\/nowhere isn't writable. Make sure it's writable to the user that the webserver is using/", $e->getMessage()); $this->assertRegExp('/When using Bolt as a Composer package it will need to have access to the following folders/', $e->getMessage()); $this->assertRegExp('/Bolt - Fatal Error/', $e::$screen); } }