Replacement of assertEquals() to assertSame()
This commit is contained in:
@ -28,9 +28,9 @@ class EnvTest extends PHPUnit_Framework_TestCase
|
||||
define('DEBUG', false);
|
||||
}
|
||||
$_SERVER['REQUEST_URI'] = '/test/index.php?id=1&test=wet&id_theme=512';
|
||||
$this->assertEquals('/test/index.php', Env::getRequestUri());
|
||||
$this->assertSame('/test/index.php', Env::getRequestUri());
|
||||
$_SERVER['REQUEST_URI'] = '/tes?t/index.php?id=1&test=wet&id_theme=512';
|
||||
$this->assertEquals('/test/index.php', Env::getRequestUri());
|
||||
$this->assertSame('/test/index.php', Env::getRequestUri());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -48,13 +48,13 @@ class EnvTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
FrontController::getInstance()->setBaseUrl('/test');
|
||||
$_SERVER['REQUEST_URI'] = '/test/index.php?id=1&test=wet&id_theme=512';
|
||||
$this->assertEquals('/index.php', Env::getRequestUri(true));
|
||||
$this->assertSame('/index.php', Env::getRequestUri(true));
|
||||
}
|
||||
|
||||
public function testServer()
|
||||
{
|
||||
$this->assertEquals($_SERVER, Env::Server());
|
||||
$this->assertEquals($_SERVER['DOCUMENT_ROOT'], Env::Server('DOCUMENT_ROOT'));
|
||||
$this->assertSame($_SERVER, Env::Server());
|
||||
$this->assertSame($_SERVER['DOCUMENT_ROOT'], Env::Server('DOCUMENT_ROOT'));
|
||||
$this->assertNotEmpty(Env::Server());
|
||||
$this->assertArrayHasKey('DOCUMENT_ROOT', Env::Server());
|
||||
}
|
||||
@ -63,52 +63,52 @@ class EnvTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
$this->assertTrue(Env::setCookie('var', 'value', 20));
|
||||
$_COOKIE['var'] = 'value';
|
||||
$this->assertEquals(array('var' => 'value'), Env::Cookie());
|
||||
$this->assertEquals('value', Env::Cookie('var'));
|
||||
$this->assertEquals('default', Env::Cookie('new', 'default'));
|
||||
$this->assertSame(array('var' => 'value'), Env::Cookie());
|
||||
$this->assertSame('value', Env::Cookie('var'));
|
||||
$this->assertSame('default', Env::Cookie('new', 'default'));
|
||||
}
|
||||
|
||||
public function testPost()
|
||||
{
|
||||
$_POST['var'] = 'value';
|
||||
$this->assertEquals(array('var' => 'value'), Env::Post());
|
||||
$this->assertEquals('value', Env::Post('var'));
|
||||
$this->assertEquals('default', Env::Post('new', 'default'));
|
||||
$this->assertSame(array('var' => 'value'), Env::Post());
|
||||
$this->assertSame('value', Env::Post('var'));
|
||||
$this->assertSame('default', Env::Post('new', 'default'));
|
||||
}
|
||||
|
||||
public function testGet()
|
||||
{
|
||||
$_GET['var'] = 'value';
|
||||
$this->assertEquals(array('var' => 'value'), Env::Get());
|
||||
$this->assertEquals('value', Env::Get('var'));
|
||||
$this->assertEquals('default', Env::Get('new', 'default'));
|
||||
$this->assertSame(array('var' => 'value'), Env::Get());
|
||||
$this->assertSame('value', Env::Get('var'));
|
||||
$this->assertSame('default', Env::Get('new', 'default'));
|
||||
}
|
||||
|
||||
public function testFiles()
|
||||
{
|
||||
$this->assertEquals('default', Env::Files('file.txt', 'default'));
|
||||
$this->assertEquals(array(), Env::Files());
|
||||
$this->assertSame('default', Env::Files('file.txt', 'default'));
|
||||
$this->assertSame(array(), Env::Files());
|
||||
}
|
||||
|
||||
public function testUnsetFiles()
|
||||
{
|
||||
unset($_FILES);
|
||||
$this->assertEquals('default', Env::Files('file.txt', 'default'));
|
||||
$this->assertSame('default', Env::Files('file.txt', 'default'));
|
||||
$_FILES['file'] = array('name' => 'files', 'path' => '/');
|
||||
$this->assertEquals(array('name' => 'files', 'path' => '/'), Env::Files('file', 'default'));
|
||||
$this->assertEquals('files', Env::Files('file', 'empty', 'name'));
|
||||
$this->assertSame(array('name' => 'files', 'path' => '/'), Env::Files('file', 'default'));
|
||||
$this->assertSame('files', Env::Files('file', 'empty', 'name'));
|
||||
}
|
||||
|
||||
public function testParams()
|
||||
{
|
||||
Env::setParams(array('name' => 'tony', 'age' => 21));
|
||||
$this->assertEquals(array('name' => 'tony', 'age' => 21), Env::getParam());
|
||||
$this->assertSame(array('name' => 'tony', 'age' => 21), Env::getParam());
|
||||
Env::setParams(array('sex' => 'male'));
|
||||
$this->assertEquals(array('name' => 'tony', 'age' => 21, 'sex' => 'male'), Env::getParam());
|
||||
$this->assertEquals('tony', Env::getParam('name'));
|
||||
$this->assertEquals('default', Env::getParam('height', 'default'));
|
||||
$this->assertSame(array('name' => 'tony', 'age' => 21, 'sex' => 'male'), Env::getParam());
|
||||
$this->assertSame('tony', Env::getParam('name'));
|
||||
$this->assertSame('default', Env::getParam('height', 'default'));
|
||||
Env::setParam('surname', 'grebnev');
|
||||
$this->assertEquals('grebnev', Env::getParam('surname'));
|
||||
$this->assertSame('grebnev', Env::getParam('surname'));
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
|
Reference in New Issue
Block a user