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
This commit is contained in:
mark_story 2011-11-13 20:47:55 -05:00
parent de5a4ead25
commit 87f5b6cf26
7 changed files with 21 additions and 24 deletions

View file

@ -546,9 +546,9 @@ class CakeEmail {
}
/**
* Set Subject
* Get/Set Subject.
*
* @param string $subject
* @param null|string $subject
* @return mixed
*/
public function subject($subject = null) {

View file

@ -214,7 +214,8 @@ class SmtpTransport extends AbstractTransport {
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 file

@ -733,11 +733,11 @@ class DboSourceTest extends CakeTestCase {
*/
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 file

@ -390,10 +390,6 @@ class CakeEmailTest extends CakeTestCase {
$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 file

@ -5,23 +5,23 @@ class Test2OtherSource extends DataSource {
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 file

@ -5,23 +5,23 @@ class Test2Source extends DataSource {
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 file

@ -5,23 +5,23 @@ class TestOtherSource extends DataSource {
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');
}
}