Cleaning up tests

This commit is contained in:
Josh Sherman 2014-09-26 07:31:04 -04:00
parent bdb16009c1
commit 6097e29aef
8 changed files with 17 additions and 202 deletions

View file

@ -23,16 +23,6 @@ if (!file_exists(SITE_MODULE_PATH))
mkdir(SITE_MODULE_PATH, 0644);
}
if (!file_exists(SITE_TEMPLATE_PATH))
{
mkdir(SITE_TEMPLATE_PATH, 0644);
}
if (!file_exists(SITE_TEMPLATE_PATH . '__shared/'))
{
mkdir(SITE_TEMPLATE_PATH . '__shared/', 0644);
}
$_SERVER['HTTP_HOST'] = 'testsite.com';
$_SERVER['SERVER_NAME'] = 'Test Server';
$_SERVER['SERVER_ADDR'] = '127.0.0.1';

View file

@ -2,42 +2,6 @@
class BrowserTest extends PHPUnit_Framework_TestCase
{
public function testGetInstance()
{
$this->assertInstanceOf('Browser', Browser::getInstance());
}
public function testSetAndGet()
{
$this->assertTrue(Browser::set('foo', 'bar'));
$this->assertEquals('bar', Browser::get('foo'));
}
public function testMissingVariable()
{
$this->assertFalse(Browser::get('missing'));
}
public function testGoHome()
{
Browser::goHome();
$this->assertTrue(in_array('Location: http://testsite.com/', xdebug_get_headers()));
}
public function testIsMobile()
{
$_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16';
$this->assertTrue(Browser::isMobile());
}
public function testIsNotMobile()
{
$_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_1) AppleWebKit/537.73.11 (KHTML, like Gecko) Version/7.0.1 Safari/537.73.11';
$this->assertFalse(Browser::isMobile());
}
public function testRemoteIPNone()
{
$this->assertFalse(Browser::remoteIP());
@ -64,6 +28,11 @@ class BrowserTest extends PHPUnit_Framework_TestCase
$this->assertEquals('3.4.5.6', Browser::remoteIP());
}
public function testRemoteIPWithComma()
{
}
public function testStatus1xx()
{
Browser::status(100);
@ -93,13 +62,5 @@ class BrowserTest extends PHPUnit_Framework_TestCase
Browser::status(500);
$this->assertTrue(in_array('Status: 500 Internal Server Error', xdebug_get_headers()));
}
public function testRefresh()
{
$_SERVER['REQUEST_URI'] = '/some/uri';
Browser::goHome();
Browser::refresh();
$this->assertTrue(in_array('Location: http://testsite.com/some/uri', xdebug_get_headers()));
}
}

View file

@ -7,10 +7,8 @@ class RouterTest extends PHPUnit_Framework_TestCase
public function setUp()
{
$this->config = Config::getInstance();
$this->config->data['pickles']['disabled'] = false;
$this->config->data['pickles']['profiler'] = false;
$this->config->data['security']['levels'][10] = 'USER';
$this->config->data['security']['levels'][20] = 'ADMIN';
$this->config->data['pickles']['disabled'] = false;
$this->config->data['pickles']['profiler'] = false;
setUpRequest('home');