Commit bf509b67 authored by Taylor Otwell's avatar Taylor Otwell

added config class tests.

parent 18b6cc44
<?php
class ConfigTest extends PHPUnit_Framework_TestCase {
/**
* Tear down the testing environment.
*/
public function tearDown()
{
Config::$items = array();
Config::$cache = array();
}
/**
* Test the Config::get method.
*
* @group laravel
*/
public function testItemsCanBeRetrievedFromConfigFiles()
{
$this->assertEquals('UTF-8', Config::get('application.encoding'));
$this->assertEquals('mysql', Config::get('database.connections.mysql.driver'));
$this->assertEquals('dashboard', Config::get('dashboard::meta.bundle'));
}
/**
* Test the Config::has method.
*
* @group laravel
*/
public function testHasMethodIndicatesIfConfigItemExists()
{
$this->assertFalse(Config::has('application.foo'));
$this->assertTrue(Config::has('application.encoding'));
}
/**
* Test the Config::set method.
*
* @group laravel
*/
public function testConfigItemsCanBeSet()
{
Config::set('application.encoding', 'foo');
Config::set('dashboard::meta.bundle', 'bar');
$this->assertEquals('foo', Config::get('application.encoding'));
$this->assertEquals('bar', Config::get('dashboard::meta.bundle'));
}
/**
* Test that environment configurations are loaded correctly.
*
* @group laravel
*/
public function testEnvironmentConfigsOverrideNormalConfigurations()
{
$_SERVER['LARAVEL_ENV'] = 'local';
$this->assertEquals('sqlite', Config::get('database.default'));
unset($_SERVER['LARAVEL_ENV']);
}
}
\ No newline at end of file
<?php
return array(
'default' => 'sqlite',
);
\ No newline at end of file
<?php
return array(
'bundle' => 'dashboard',
);
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment