Skip to content

Instantly share code, notes, and snippets.

@michaeltwofish
Created July 13, 2011 08:36
Show Gist options
  • Save michaeltwofish/1079935 to your computer and use it in GitHub Desktop.
Save michaeltwofish/1079935 to your computer and use it in GitHub Desktop.
<?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