Remove useless backups.

PHPUnit does this for us.
Fix formatting and whitespace.
This commit is contained in:
mark_story 2012-04-17 21:50:47 -04:00
parent c871d85f2b
commit c15259f49c

View file

@ -30,10 +30,6 @@ class CakeRequestTest extends CakeTestCase {
*/ */
public function setUp() { public function setUp() {
parent::setUp(); parent::setUp();
$this->_server = $_SERVER;
$this->_get = $_GET;
$this->_post = $_POST;
$this->_files = $_FILES;
$this->_app = Configure::read('App'); $this->_app = Configure::read('App');
$this->_case = null; $this->_case = null;
if (isset($_GET['case'])) { if (isset($_GET['case'])) {
@ -51,10 +47,6 @@ class CakeRequestTest extends CakeTestCase {
*/ */
public function tearDown() { public function tearDown() {
parent::tearDown(); parent::tearDown();
$_SERVER = $this->_server;
$_GET = $this->_get;
$_POST = $this->_post;
$_FILES = $this->_files;
if (!empty($this->_case)) { if (!empty($this->_case)) {
$_GET['case'] = $this->_case; $_GET['case'] = $this->_case;
} }
@ -217,94 +209,106 @@ class CakeRequestTest extends CakeTestCase {
* *
* @return void * @return void
*/ */
public function testFILESParsing() { public function testFilesParsing() {
$_FILES = array('data' => array('name' => array( $_FILES = array(
'File' => array( 'data' => array(
array('data' => 'cake_sqlserver_patch.patch'), 'name' => array(
array('data' => 'controller.diff'), 'File' => array(
array('data' => ''), array('data' => 'cake_sqlserver_patch.patch'),
array('data' => ''), array('data' => 'controller.diff'),
array('data' => ''),
array('data' => ''),
),
'Post' => array('attachment' => 'jquery-1.2.1.js'),
),
'type' => array(
'File' => array(
array('data' => ''),
array('data' => ''),
array('data' => ''),
array('data' => ''),
),
'Post' => array('attachment' => 'application/x-javascript'),
), ),
'Post' => array('attachment' => 'jquery-1.2.1.js'), 'tmp_name' => array(
), 'File' => array(
'type' => array( array('data' => '/private/var/tmp/phpy05Ywj'),
'File' => array( array('data' => '/private/var/tmp/php7MBztY'),
array('data' => ''), array('data' => ''),
array('data' => ''), array('data' => ''),
array('data' => ''), ),
array('data' => ''), 'Post' => array('attachment' => '/private/var/tmp/phpEwlrIo'),
), ),
'Post' => array('attachment' => 'application/x-javascript'), 'error' => array(
), 'File' => array(
'tmp_name' => array( array('data' => 0),
'File' => array( array('data' => 0),
array('data' => '/private/var/tmp/phpy05Ywj'), array('data' => 4),
array('data' => '/private/var/tmp/php7MBztY'), array('data' => 4)
array('data' => ''), ),
array('data' => ''), 'Post' => array('attachment' => 0)
), ),
'Post' => array('attachment' => '/private/var/tmp/phpEwlrIo'), 'size' => array(
), 'File' => array(
'error' => array( array('data' => 6271),
'File' => array( array('data' => 350),
array('data' => 0), array('data' => 0),
array('data' => 0), array('data' => 0),
array('data' => 4), ),
array('data' => 4) 'Post' => array('attachment' => 80469)
), ),
'Post' => array('attachment' => 0) )
), );
'size' => array(
'File' => array(
array('data' => 6271),
array('data' => 350),
array('data' => 0),
array('data' => 0),
),
'Post' => array('attachment' => 80469)
),
));
$request = new CakeRequest('some/path'); $request = new CakeRequest('some/path');
$expected = array( $expected = array(
'File' => array( 'File' => array(
array('data' => array(
'name' => 'cake_sqlserver_patch.patch',
'type' => '',
'tmp_name' => '/private/var/tmp/phpy05Ywj',
'error' => 0,
'size' => 6271,
)),
array( array(
'data' => array( 'data' => array(
'name' => 'controller.diff', 'name' => 'cake_sqlserver_patch.patch',
'type' => '', 'type' => '',
'tmp_name' => '/private/var/tmp/php7MBztY', 'tmp_name' => '/private/var/tmp/phpy05Ywj',
'error' => 0, 'error' => 0,
'size' => 350, 'size' => 6271,
)), )
array('data' => array( ),
'name' => '', array(
'type' => '', 'data' => array(
'tmp_name' => '', 'name' => 'controller.diff',
'error' => 4, 'type' => '',
'size' => 0, 'tmp_name' => '/private/var/tmp/php7MBztY',
)), 'error' => 0,
array('data' => array( 'size' => 350,
'name' => '', )
'type' => '', ),
'tmp_name' => '', array(
'error' => 4, 'data' => array(
'size' => 0, 'name' => '',
)), 'type' => '',
'tmp_name' => '',
'error' => 4,
'size' => 0,
)
),
array(
'data' => array(
'name' => '',
'type' => '',
'tmp_name' => '',
'error' => 4,
'size' => 0,
)
),
), ),
'Post' => array('attachment' => array( 'Post' => array(
'name' => 'jquery-1.2.1.js', 'attachment' => array(
'type' => 'application/x-javascript', 'name' => 'jquery-1.2.1.js',
'tmp_name' => '/private/var/tmp/phpEwlrIo', 'type' => 'application/x-javascript',
'error' => 0, 'tmp_name' => '/private/var/tmp/phpEwlrIo',
'size' => 80469, 'error' => 0,
)) 'size' => 80469,
)
)
); );
$this->assertEquals($expected, $request->data); $this->assertEquals($expected, $request->data);
@ -343,12 +347,12 @@ class CakeRequestTest extends CakeTestCase {
1 => array( 1 => array(
'birth_cert' => '/private/var/tmp/phpbsUWfH', 'birth_cert' => '/private/var/tmp/phpbsUWfH',
'passport' => '/private/var/tmp/php7f5zLt', 'passport' => '/private/var/tmp/php7f5zLt',
'drivers_license' => '/private/var/tmp/phpMXpZgT', 'drivers_license' => '/private/var/tmp/phpMXpZgT',
), ),
2 => array( 2 => array(
'birth_cert' => '/private/var/tmp/php5kHZt0', 'birth_cert' => '/private/var/tmp/php5kHZt0',
'passport' => '/private/var/tmp/phpnYkOuM', 'passport' => '/private/var/tmp/phpnYkOuM',
'drivers_license' => '/private/var/tmp/php9Rq0P3', 'drivers_license' => '/private/var/tmp/php9Rq0P3',
) )
) )
), ),
@ -357,12 +361,12 @@ class CakeRequestTest extends CakeTestCase {
1 => array( 1 => array(
'birth_cert' => 0, 'birth_cert' => 0,
'passport' => 0, 'passport' => 0,
'drivers_license' => 0, 'drivers_license' => 0,
), ),
2 => array( 2 => array(
'birth_cert' => 0, 'birth_cert' => 0,
'passport' => 0, 'passport' => 0,
'drivers_license' => 0, 'drivers_license' => 0,
) )
) )
), ),
@ -371,12 +375,12 @@ class CakeRequestTest extends CakeTestCase {
1 => array( 1 => array(
'birth_cert' => 123, 'birth_cert' => 123,
'passport' => 458, 'passport' => 458,
'drivers_license' => 875, 'drivers_license' => 875,
), ),
2 => array( 2 => array(
'birth_cert' => 876, 'birth_cert' => 876,
'passport' => 976, 'passport' => 976,
'drivers_license' => 9783, 'drivers_license' => 9783,
) )
) )
) )