Permalink
Browse files

Fix failing tests.

This fixes some but not all the failing tests in the network group.
  • Loading branch information...
1 parent 95d45dd commit 6e9d8c283472aeaac7da5940eeda83d8dbe46027 @markstory markstory committed Jan 4, 2013
@@ -363,7 +363,11 @@ protected static function _base() {
protected function _processFiles($post, $files) {
if (isset($files) && is_array($files)) {
foreach ($files as $key => $data) {
- $this->_processFileData($post, '', $data, $key);
+ if (!is_numeric($key)) {
+ $this->_processFileData($post, '', $data, $key);
+ } else {
+ $post[$key] = $data;
+ }
}
}
return $post;
@@ -169,7 +169,7 @@ public function connect() {
if (!$this->connection && $this->_connectionErrors) {
$message = implode("\n", $this->_connectionErrors);
- throw new SocketException($message, E_WARNING);
+ throw new Error\SocketException($message, E_WARNING);
}
$this->connected = is_resource($this->connection);
@@ -997,7 +997,7 @@ public function testSendWithNoContentDispositionAttachments() {
*/
public function testSendWithLog() {
$path = CAKE . 'Test/TestApp/tmp/';
- $log = $this->getMock('Cake\Log\Engine\BaseLog', ['write'], ['scopes' => 'email']);
+ $log = $this->getMock('Cake\Log\Engine\BaseLog', ['write'], [['scopes' => 'email']]);
$message = 'Logging This';
@@ -224,7 +224,7 @@ public function testPutParsingJSON() {
$_SERVER['REQUEST_METHOD'] = 'PUT';
$_SERVER['CONTENT_TYPE'] = 'application/json';
- $data = '{Article":["title"]}';
+ $data = '{"Article":["title"]}';
$request = new Request([
'input' => $data
]);
@@ -488,9 +488,11 @@ public function testFilesParsing() {
/**
* Test that files in the 0th index work.
+ *
+ * @return void
*/
public function testFilesZeroithIndex() {
- $_FILES = array(
+ $files = array(
0 => array(
'name' => 'cake_sqlserver_patch.patch',
'type' => 'text/plain',
@@ -500,8 +502,10 @@ public function testFilesZeroithIndex() {
),
);
- $request = new Request('some/path');
- $this->assertEquals($_FILES, $request->params['form']);
+ $request = new Request([
+ 'files' => $files
+ ]);
+ $this->assertEquals($files, $request->data);
}
/**
@@ -1668,10 +1672,9 @@ public function testEnvironmentDetection($name, $env, $expected) {
* @return void
*/
public function testQuery() {
- $_GET = array();
- $_GET['foo'] = 'bar';
-
- $request = new Request();
+ $request = new Request([
+ 'query' => ['foo' => 'bar']
+ ]);
$result = $request->query('foo');
$this->assertEquals('bar', $result);
@@ -1686,10 +1689,11 @@ public function testQuery() {
* @return void
*/
public function testQueryWithArray() {
- $_GET = array();
- $_GET['test'] = array('foo', 'bar');
+ $get['test'] = array('foo', 'bar');
- $request = new Request();
+ $request = new Request([
+ 'query' => $get
+ ]);
$result = $request->query('test');
$this->assertEquals(array('foo', 'bar'), $result);
@@ -263,7 +263,7 @@ protected function _connectSocketToSslTls() {
/**
* testEnableCryptoBadMode
*
- * @expectedException InvalidArgumentException
+ * @expectedException \InvalidArgumentException
* @return void
*/
public function testEnableCryptoBadMode() {
@@ -343,7 +343,7 @@ public function testGetContext() {
'ssl' => array('capture_peer' => true)
)
);
- $this->Socket = new CakeSocket($config);
+ $this->Socket = new Socket($config);
$this->Socket->connect();
$result = $this->Socket->context();
$this->assertEquals($config['context'], $result);

0 comments on commit 6e9d8c2

Please sign in to comment.