コード例 #1
0
ファイル: DatabaseTest.php プロジェクト: bolt/bolt
 public function testUpdate()
 {
     $this->allowLogin($this->getApp());
     $checkResponse = new SchemaCheck();
     $check = $this->getMockSchemaManager(['update']);
     $check->expects($this->any())->method('update')->will($this->returnValue($checkResponse));
     $this->setService('schema', $check);
     ResourceManager::$theApp = $this->getApp();
     $this->setRequest(Request::create('/bolt/dbupdate', 'POST'));
     $response = $this->controller()->update($this->getRequest());
     $this->assertEquals(Response::HTTP_FOUND, $response->getStatusCode());
     $this->assertEquals('/bolt/dbupdate_result', $response->getTargetUrl());
 }
コード例 #2
0
 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);
 }
コード例 #3
0
 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);
     }
 }
コード例 #4
0
ファイル: DatabaseTest.php プロジェクト: nuffer/bolt
 public function testUpdate()
 {
     $this->allowLogin($this->getApp());
     $checkResponse = new \Bolt\Storage\Database\Schema\CheckResponse();
     $check = $this->getMock('Bolt\\Storage\\Database\\Schema\\Manager', ['repairTables'], [$this->getApp()]);
     $check->expects($this->any())->method('repairTables')->will($this->returnValue($checkResponse));
     $this->setService('schema', $check);
     ResourceManager::$theApp = $this->getApp();
     $this->setRequest(Request::create('/bolt/dbupdate', 'POST', ['return' => 'edit']));
     $response = $this->controller()->update($this->getRequest());
     $this->assertEquals(Response::HTTP_FOUND, $response->getStatusCode());
     $this->assertEquals('/bolt/file/edit/config/contenttypes.yml', $response->getTargetUrl());
     $this->assertNotEmpty($this->getFlashBag()->get('success'));
     $this->setRequest(Request::create('/bolt/dbupdate', 'POST', ['return' => 'edit']));
     $response = $this->controller()->update($this->getRequest());
     $this->assertEquals(Response::HTTP_FOUND, $response->getStatusCode());
     $this->assertEquals('/bolt/file/edit/config/contenttypes.yml', $response->getTargetUrl());
     $this->assertNotEmpty($this->getFlashBag()->get('success'));
     $this->setRequest(Request::create('/bolt/dbupdate', 'POST'));
     $response = $this->controller()->update($this->getRequest());
     $this->assertEquals(Response::HTTP_FOUND, $response->getStatusCode());
     $this->assertEquals('/bolt/dbupdate_result', $response->getTargetUrl());
 }
コード例 #5
0
ファイル: ResourceManager.php プロジェクト: nectd/nectd-web
 /**
  * @deprecated Don't use! Will probably refactored out soon
  *
  * @param Application $app
  */
 public function setApp(Application $app)
 {
     $this->app = $app;
     ResourceManager::$theApp = $app;
 }
コード例 #6
0
 public function testGeneralFatalErrorCatch()
 {
     $app = ['resources' => new Standard(TEST_ROOT)];
     ResourceManager::$theApp = $app;
     $this->php2->expects($this->once())->method('error_get_last')->will($this->returnValue($this->errorResponses['unknown']));
     $this->expectOutputRegex('/PHP Fatal error: Bolt generic/');
     LowlevelException::catchFatalErrors($this->getApp(), false);
 }
コード例 #7
0
ファイル: BackendTest.php プロジェクト: aaleksu/bolt_cm
 public function testSystemLog()
 {
     $app = $this->getApp();
     $this->allowLogin($app);
     $log = $this->getMock('Bolt\\Logger\\Manager', array('clear', 'trim'), array($app));
     $log->expects($this->once())->method('clear')->will($this->returnValue(true));
     $log->expects($this->once())->method('trim')->will($this->returnValue(true));
     $app['logger.manager'] = $log;
     ResourceManager::$theApp = $app;
     $request = Request::create('/bolt/systemlog', 'GET', array('action' => 'trim'));
     $response = $app->handle($request);
     $this->assertNotEmpty($app['session']->getFlashBag()->get('success'));
     $request = Request::create('/bolt/systemlog', 'GET', array('action' => 'clear'));
     $response = $app->handle($request);
     $this->assertNotEmpty($app['session']->getFlashBag()->get('success'));
     $this->assertEquals('/bolt/systemlog', $response->getTargetUrl());
     $request = Request::create('/bolt/systemlog');
     $this->checkTwigForTemplate($app, 'activity/systemlog.twig');
     $app->run($request);
 }