Skip to content

Commit

Permalink
cleaning up the extra spaces in the controller
Browse files Browse the repository at this point in the history
  • Loading branch information
bobeagan committed Feb 22, 2011
1 parent 3425c12 commit 1f17872
Showing 1 changed file with 12 additions and 20 deletions.
32 changes: 12 additions & 20 deletions classes/controller/unittest.php
Expand Up @@ -73,10 +73,10 @@ public function before()
// This just stops some very very long lines
$route = Route::get('unittest');
$this->report_uri = $route->uri(array('action' => 'report'));
$this->run_uri = $route->uri(array('action' => 'run'));
$this->run_uri = $route->uri(array('action' => 'run'));

// Switch used to disable cc settings
$this->xdebug_loaded = extension_loaded('xdebug');
$this->xdebug_loaded = extension_loaded('xdebug');
$this->cc_archive_enabled = class_exists('Archive');

Kohana_View::set_global('xdebug_enabled', $this->xdebug_loaded);
Expand All @@ -102,16 +102,14 @@ public function action_report()
{
// Fairly foolproof
if ( ! $this->config->cc_report_path AND ! class_exists('Archive'))
{
throw new Kohana_Exception('Cannot generate report');
}

// We don't want to use the HTML layout, we're sending the user 100111011100110010101100
$this->auto_render = FALSE;

$suite = Unittest_tests::suite();
$suite = Unittest_tests::suite();
$temp_path = rtrim($this->config->temp_path, '/').'/';
$group = (array) Arr::get($_GET, 'group', array());
$group = (array) Arr::get($_GET, 'group', array());

// Stop unittest from interpretting "all groups" as "no groups"
if (empty($group) OR empty($group[0]))
Expand Down Expand Up @@ -150,17 +148,13 @@ public function action_report()
else
{
$folder = trim($this->config->cc_report_path, '/').'/';
$path = DOCROOT.$folder;
$path = DOCROOT.$folder;

if ( ! file_exists($path))
{
throw new Kohana_Exception('Report directory :dir does not exist', array(':dir' => $path));
}

if ( ! is_writable($path))
{
throw new Kohana_Exception('Script doesn\'t have permission to write to report dir :dir ', array(':dir' => $path));
}

$runner->generate_report($group, $path, FALSE);

Expand Down Expand Up @@ -220,20 +214,20 @@ public function action_run()
// Show some results
$this->template->body
->set('results', $runner->results)
->set('totals', $runner->totals)
->set('time', $this->nice_time($runner->time))
->set('totals', $runner->totals)
->set('time', $this->nice_time($runner->time))

// Sets group to the currently selected group, or default all groups
->set('group', Arr::get($this->get_groups_list($suite), reset($group), 'All groups'))
->set('group', Arr::get($this->get_groups_list($suite), reset($group), 'All groups'))
->set('groups', $this->get_groups_list($suite))

->set('run_uri', $this->request->uri())
->set('report_uri', $this->report_uri.url::query())
->set('run_uri', $this->request->uri())
->set('report_uri', $this->report_uri.url::query())

// Whitelist related stuff
->set('whitelistable_items', $this->get_whitelistable_items())
->set('whitelisted_items', isset($whitelist) ? array_keys($whitelist) : array())
->set('whitelist', ! empty($whitelist));
->set('whitelisted_items', isset($whitelist) ? array_keys($whitelist) : array())
->set('whitelist', ! empty($whitelist));
}

/**
Expand Down Expand Up @@ -263,9 +257,7 @@ protected function get_whitelistable_items()
static $whitelist;

if (count($whitelist))
{
return $whitelist;
}

$whitelist = array();

Expand Down

0 comments on commit 1f17872

Please sign in to comment.