Created
July 13, 2011 08:36
-
-
Save michaeltwofish/1079935 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace app\controllers; | |
use \lithium\storage\Session; | |
use \lithium\net\http\Router; | |
use \lithium\analysis\Logger; | |
use \acer\core\Environment; | |
/** | |
* The connection controller is for acceptance tests to tell the application it | |
* is being tested. | |
*/ | |
class ConnectionController extends \app\controllers\AppController { | |
public function index() { | |
if (isset($this->request->params['connection']) && !empty($this->request->params['connection'])) { | |
$connection = $this->request->params['connection']; | |
Session::write('connection', $connection); | |
Logger::debug('The connection has been manually (via connection/) set to ' . $connection); | |
} | |
return $this->redirect(array('controller' => 'connection', 'action' => 'show')); | |
} | |
public function show() { | |
if (Session::check('connection')) { | |
$connection = Session::read('connection'); | |
} else { | |
$connection = 'connection not set'; | |
} | |
$this->set(compact('connection')); | |
} | |
public function destroy() { | |
Session::delete('connection'); | |
Logger::debug('The connection which was set manually has now been destroyed'); | |
return $this->redirect(array('controller' => 'connection', 'action' => 'show')); | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment