Skip to content
Browse files

Fix more strict errors.

Fix strict errors in test files.
Remove a test in CakeEmail as array -> string causes a notice
in PHP 5.4
  • Loading branch information...
1 parent de5a4ea commit 87f5b6cf26b1a6efaf6be228bb9f70032f9f0212 @markstory markstory committed
View
4 lib/Cake/Network/Email/CakeEmail.php
@@ -546,9 +546,9 @@ protected function _addEmail($varName, $email, $name) {
}
/**
- * Set Subject
+ * Get/Set Subject.
*
- * @param string $subject
+ * @param null|string $subject
* @return mixed
*/
public function subject($subject = null) {
View
3 lib/Cake/Network/Email/SmtpTransport.php
@@ -214,7 +214,8 @@ protected function _smtpSend($data, $checkCode = '250') {
if (substr($response, -2) !== "\r\n") {
throw new SocketException(__d('cake_dev', 'SMTP timeout.'));
}
- $response = end(explode("\r\n", rtrim($response, "\r\n")));
+ $responseLines = explode("\r\n", rtrim($response, "\r\n"));
+ $response = end($responseLines);
if (preg_match('/^(' . $checkCode . ')(.)/', $response, $code)) {
if ($code[2] === '-') {
View
4 lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php
@@ -733,11 +733,11 @@ public function testReadOnlyCallingQueryAssociationWhenDefined() {
*/
public function testFieldsUsingMethodCache() {
$this->testDb->cacheMethods = false;
- $this->assertTrue(empty($this->testDb->methodCache['fields']), 'Cache not empty');
+ DboTestSource::$methodCache = array();
$Article = ClassRegistry::init('Article');
$this->testDb->fields($Article, null, array('title', 'body', 'published'));
- $this->assertTrue(empty($this->testDb->methodCache['fields']), 'Cache not empty');
+ $this->assertTrue(empty(DboTestSource::$methodCache['fields']), 'Cache not empty');
}
/**
View
4 lib/Cake/Test/Case/Network/Email/CakeEmailTest.php
@@ -390,10 +390,6 @@ public function testSubject() {
$this->CakeEmail->subject(1);
$this->assertIdentical($this->CakeEmail->subject(), '1');
- $result = $this->CakeEmail->subject(array('something'));
- $this->assertIdentical($this->CakeEmail->subject(), 'Array');
- $this->assertIdentical($this->CakeEmail, $result);
-
$this->CakeEmail->subject('هذه رسالة بعنوان طويل مرسل للمستلم');
$expected = '=?UTF-8?B?2YfYsNmHINix2LPYp9mE2Kkg2KjYudmG2YjYp9mGINi32YjZitmEINmF2LE=?=' . "\r\n" . ' =?UTF-8?B?2LPZhCDZhNmE2YXYs9iq2YTZhQ==?=';
$this->assertIdentical($this->CakeEmail->subject(), $expected);
View
10 lib/Cake/Test/test_app/Model/Datasource/Test2OtherSource.php
@@ -5,23 +5,23 @@ public function describe($model) {
return compact('model');
}
- public function listSources() {
+ public function listSources($data = null) {
return array('test_source');
}
- public function create($model, $fields = array(), $values = array()) {
+ public function create(Model $model, $fields = null, $values = null) {
return compact('model', 'fields', 'values');
}
- public function read($model, $queryData = array()) {
+ public function read(Model $model, $queryData = array()) {
return compact('model', 'queryData');
}
- public function update($model, $fields = array(), $values = array()) {
+ public function update(Model $model, $fields = array(), $values = array()) {
return compact('model', 'fields', 'values');
}
- public function delete($model, $id) {
+ public function delete(Model $model, $id = null) {
return compact('model', 'id');
}
}
View
10 lib/Cake/Test/test_app/Model/Datasource/Test2Source.php
@@ -5,23 +5,23 @@ public function describe($model) {
return compact('model');
}
- public function listSources() {
+ public function listSources($data = null) {
return array('test_source');
}
- public function create($model, $fields = array(), $values = array()) {
+ public function create(Model $model, $fields = null, $values = null) {
return compact('model', 'fields', 'values');
}
- public function read($model, $queryData = array()) {
+ public function read(Model $model, $queryData = array()) {
return compact('model', 'queryData');
}
- public function update($model, $fields = array(), $values = array()) {
+ public function update(Model $model, $fields = array(), $values = array()) {
return compact('model', 'fields', 'values');
}
- public function delete($model, $id) {
+ public function delete(Model $model, $id = null) {
return compact('model', 'id');
}
}
View
10 lib/Cake/Test/test_app/Plugin/TestPlugin/Model/Datasource/test_other_source.php
@@ -5,23 +5,23 @@ public function describe($model) {
return compact('model');
}
- public function listSources() {
+ public function listSources($data = null) {
return array('test_source');
}
- public function create($model, $fields = array(), $values = array()) {
+ public function create(Model $model, $fields = null, $values = array()) {
return compact('model', 'fields', 'values');
}
- public function read($model, $queryData = array()) {
+ public function read(Model $model, $queryData = array()) {
return compact('model', 'queryData');
}
- public function update($model, $fields = array(), $values = array()) {
+ public function update(Model $model, $fields = array(), $values = array()) {
return compact('model', 'fields', 'values');
}
- public function delete($model, $id) {
+ public function delete(Model $model, $id = null) {
return compact('model', 'id');
}
}

0 comments on commit 87f5b6c

Please sign in to comment.
Something went wrong with that request. Please try again.