Skip to content

Commit

Permalink
Added Swiftlet\Exception, tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AliasIO committed Jun 19, 2013
1 parent d4bb11b commit 3e8b59e
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 12 deletions.
6 changes: 3 additions & 3 deletions Swiftlet/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -252,11 +252,11 @@ public function autoload($className)
* @param string $string
* @param string $file
* @param int $line
*
* @throws \Exception
*
* @throws Exception
*/
public function error($number, $string, $file, $line)
{
throw new \Exception('Error #' . $number . ': ' . $string . ' in ' . $file . ' on line ' . $line);
throw new Exception('Error #' . $number . ': ' . $string . ' in ' . $file . ' on line ' . $line);
}
}
4 changes: 2 additions & 2 deletions Swiftlet/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ public function index()
/**
* Fallback in case action doesn't exist
*
* @throws \Exception
* @throws Exception
*/
public function notImplemented()
{
throw new \Exception('Action ' . $this->view->htmlEncode($this->app->getAction()) . ' not implemented in ' . get_called_class());
throw new Exception('Action ' . $this->view->htmlEncode($this->app->getAction()) . ' not implemented in ' . get_called_class());
}
}
4 changes: 2 additions & 2 deletions Swiftlet/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public function htmlDecode($value)
/**
* Render the view
*
* @throws \Exception
* @throws Exception
*/
public function render()
{
Expand All @@ -139,7 +139,7 @@ public function render()

require $file;
} else {
throw new \Exception('View not found');
throw new Exception('View not found');
}
}
}
15 changes: 12 additions & 3 deletions tests/Swiftlet/AppTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,25 @@ public function testGetAction()
}

/**
* @covers Swiftlet\App::setConfig
* @covers Swiftlet\App::getConfig
*/
public function testConfig()
public function testGetConfig()
{
$test = $this->app->getConfig('test');

$this->assertNull($test, 'test');
}

/**
* @covers Swiftlet\App::setConfig
*/
public function testSetConfig()
{
$this->app->setConfig('test', 'test');

$test = $this->app->getConfig('test');

$this->assertEquals('test', $test);
$this->assertEquals($test, 'test');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/Swiftlet/ViewTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function testGet()
{
$test = $this->view->get('test');

$this->assertEmpty($test);
$this->assertNull($test);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion www/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

$app->run();
$app->serve();
} catch ( \Exception $e ) {
} catch ( Exception $e ) {
if ( !headers_sent() ) {
header('HTTP/1.1 503 Service Temporarily Unavailable');
header('Status: 503 Service Temporarily Unavailable');
Expand Down

0 comments on commit 3e8b59e

Please sign in to comment.