@@ -1877,7 +1877,7 @@ discard block |
||
1877 | 1877 | /** |
1878 | 1878 | * Singular method |
1879 | 1879 | * |
1880 | - * @return void |
|
1880 | + * @return null|string |
|
1881 | 1881 | */ |
1882 | 1882 | protected function _domainCategorySingular($domain = 'test_plugin', $category = 3) { |
1883 | 1883 | $singular = __dc($domain, 'Plural Rule 1', $category); |
@@ -1900,7 +1900,7 @@ discard block |
||
1900 | 1900 | /** |
1901 | 1901 | * Singular method |
1902 | 1902 | * |
1903 | - * @return void |
|
1903 | + * @return null|string |
|
1904 | 1904 | */ |
1905 | 1905 | protected function _domainSingular($domain = 'test_plugin') { |
1906 | 1906 | $singular = __d($domain, 'Plural Rule 1'); |
@@ -1923,7 +1923,7 @@ discard block |
||
1923 | 1923 | /** |
1924 | 1924 | * category method |
1925 | 1925 | * |
1926 | - * @return void |
|
1926 | + * @return null|string |
|
1927 | 1927 | */ |
1928 | 1928 | protected function _category($category = 3) { |
1929 | 1929 | $singular = __c('Plural Rule 1', $category); |
@@ -1933,7 +1933,7 @@ discard block |
||
1933 | 1933 | /** |
1934 | 1934 | * Singular method |
1935 | 1935 | * |
1936 | - * @return void |
|
1936 | + * @return null|string |
|
1937 | 1937 | */ |
1938 | 1938 | protected function _singular() { |
1939 | 1939 | $singular = __('Plural Rule 1'); |
@@ -1956,7 +1956,7 @@ discard block |
||
1956 | 1956 | /** |
1957 | 1957 | * singularFromCore method |
1958 | 1958 | * |
1959 | - * @return void |
|
1959 | + * @return null|string |
|
1960 | 1960 | */ |
1961 | 1961 | protected function _singularFromCore() { |
1962 | 1962 | $singular = __('Plural Rule 1 (from core)'); |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | |
36 | 36 | Cache::delete('object_map', '_cake_core_'); |
37 | 37 | App::build(array( |
38 | - 'Locale' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Locale' . DS), |
|
39 | - 'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS) |
|
38 | + 'Locale' => array(CAKE.'Test'.DS.'test_app'.DS.'Locale'.DS), |
|
39 | + 'Plugin' => array(CAKE.'Test'.DS.'test_app'.DS.'Plugin'.DS) |
|
40 | 40 | ), App::RESET); |
41 | 41 | CakePlugin::load(array('TestPlugin')); |
42 | 42 | } |
@@ -80,23 +80,23 @@ discard block |
||
80 | 80 | I18n::clear(); |
81 | 81 | |
82 | 82 | // now only dom1 should be in cache |
83 | - $cachedDom1 = Cache::read('dom1_' . $lang, '_cake_core_'); |
|
83 | + $cachedDom1 = Cache::read('dom1_'.$lang, '_cake_core_'); |
|
84 | 84 | $this->assertEquals('Dom 1 Foo', $cachedDom1['LC_MESSAGES']['dom1.foo']); |
85 | 85 | $this->assertEquals('Dom 1 Bar', $cachedDom1['LC_MESSAGES']['dom1.bar']); |
86 | 86 | // dom2 not in cache |
87 | - $this->assertFalse(Cache::read('dom2_' . $lang, '_cake_core_')); |
|
87 | + $this->assertFalse(Cache::read('dom2_'.$lang, '_cake_core_')); |
|
88 | 88 | |
89 | 89 | // translate a item of dom2 (adds dom2 to cache) |
90 | 90 | $this->assertEquals('Dom 2 Foo', I18n::translate('dom2.foo', false, 'dom2')); |
91 | 91 | |
92 | 92 | // verify dom2 was cached through manual read from cache |
93 | - $cachedDom2 = Cache::read('dom2_' . $lang, '_cake_core_'); |
|
93 | + $cachedDom2 = Cache::read('dom2_'.$lang, '_cake_core_'); |
|
94 | 94 | $this->assertEquals('Dom 2 Foo', $cachedDom2['LC_MESSAGES']['dom2.foo']); |
95 | 95 | $this->assertEquals('Dom 2 Bar', $cachedDom2['LC_MESSAGES']['dom2.bar']); |
96 | 96 | |
97 | 97 | // modify cache entry manually to verify that dom1 entries now will be read from cache |
98 | 98 | $cachedDom1['LC_MESSAGES']['dom1.foo'] = 'FOO'; |
99 | - Cache::write('dom1_' . $lang, $cachedDom1, '_cake_core_'); |
|
99 | + Cache::write('dom1_'.$lang, $cachedDom1, '_cake_core_'); |
|
100 | 100 | $this->assertEquals('FOO', I18n::translate('dom1.foo', false, 'dom1')); |
101 | 101 | } |
102 | 102 | |
@@ -1600,7 +1600,7 @@ discard block |
||
1600 | 1600 | */ |
1601 | 1601 | public function testPluginTranslation() { |
1602 | 1602 | App::build(array( |
1603 | - 'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS) |
|
1603 | + 'Plugin' => array(CAKE.'Test'.DS.'test_app'.DS.'Plugin'.DS) |
|
1604 | 1604 | )); |
1605 | 1605 | |
1606 | 1606 | Configure::write('Config.language', 'po'); |
@@ -1680,15 +1680,15 @@ discard block |
||
1680 | 1680 | $string .= "This is the third line.\n"; |
1681 | 1681 | $string .= "This is the forth line."; |
1682 | 1682 | |
1683 | - $singular = "%d = 1\n" . $string; |
|
1684 | - $plural = "%d = 0 or > 1\n" . $string; |
|
1683 | + $singular = "%d = 1\n".$string; |
|
1684 | + $plural = "%d = 0 or > 1\n".$string; |
|
1685 | 1685 | |
1686 | 1686 | $result = __n($singular, $plural, 1); |
1687 | - $expected = "%d is 1\n" . $string; |
|
1687 | + $expected = "%d is 1\n".$string; |
|
1688 | 1688 | $this->assertEquals($expected, $result); |
1689 | 1689 | |
1690 | 1690 | $result = __n($singular, $plural, 2); |
1691 | - $expected = "%d is 2-4\n" . $string; |
|
1691 | + $expected = "%d is 2-4\n".$string; |
|
1692 | 1692 | $this->assertEquals($expected, $result); |
1693 | 1693 | |
1694 | 1694 | // Windows Newline is \r\n |
@@ -1697,15 +1697,15 @@ discard block |
||
1697 | 1697 | $string .= "This is the third line.\r\n"; |
1698 | 1698 | $string .= "This is the forth line."; |
1699 | 1699 | |
1700 | - $singular = "%d = 1\r\n" . $string; |
|
1701 | - $plural = "%d = 0 or > 1\r\n" . $string; |
|
1700 | + $singular = "%d = 1\r\n".$string; |
|
1701 | + $plural = "%d = 0 or > 1\r\n".$string; |
|
1702 | 1702 | |
1703 | 1703 | $result = __n($singular, $plural, 1); |
1704 | - $expected = "%d is 1\n" . str_replace("\r\n", "\n", $string); |
|
1704 | + $expected = "%d is 1\n".str_replace("\r\n", "\n", $string); |
|
1705 | 1705 | $this->assertEquals($expected, $result); |
1706 | 1706 | |
1707 | 1707 | $result = __n($singular, $plural, 2); |
1708 | - $expected = "%d is 2-4\n" . str_replace("\r\n", "\n", $string); |
|
1708 | + $expected = "%d is 2-4\n".str_replace("\r\n", "\n", $string); |
|
1709 | 1709 | $this->assertEquals($expected, $result); |
1710 | 1710 | } |
1711 | 1711 | |
@@ -1739,15 +1739,15 @@ discard block |
||
1739 | 1739 | public function testFloatValue() { |
1740 | 1740 | Configure::write('Config.language', 'rule_9_po'); |
1741 | 1741 | |
1742 | - $result = __n('%d = 1', '%d = 0 or > 1', (float)1); |
|
1742 | + $result = __n('%d = 1', '%d = 0 or > 1', (float) 1); |
|
1743 | 1743 | $expected = '%d is 1 (translated)'; |
1744 | 1744 | $this->assertEquals($expected, $result); |
1745 | 1745 | |
1746 | - $result = __n('%d = 1', '%d = 0 or > 1', (float)2); |
|
1746 | + $result = __n('%d = 1', '%d = 0 or > 1', (float) 2); |
|
1747 | 1747 | $expected = "%d ends in 2-4, not 12-14 (translated)"; |
1748 | 1748 | $this->assertEquals($expected, $result); |
1749 | 1749 | |
1750 | - $result = __n('%d = 1', '%d = 0 or > 1', (float)5); |
|
1750 | + $result = __n('%d = 1', '%d = 0 or > 1', (float) 5); |
|
1751 | 1751 | $expected = "%d everything else (translated)"; |
1752 | 1752 | $this->assertEquals($expected, $result); |
1753 | 1753 | } |
@@ -1869,7 +1869,7 @@ discard block |
||
1869 | 1869 | */ |
1870 | 1870 | public function testLoadLocaleDefinition() { |
1871 | 1871 | $path = current(App::path('locales')); |
1872 | - $result = I18n::loadLocaleDefinition($path . 'nld' . DS . 'LC_TIME'); |
|
1872 | + $result = I18n::loadLocaleDefinition($path.'nld'.DS.'LC_TIME'); |
|
1873 | 1873 | $expected = array('zondag', 'maandag', 'dinsdag', 'woensdag', 'donderdag', 'vrijdag', 'zaterdag'); |
1874 | 1874 | $this->assertSame($expected, $result['day']); |
1875 | 1875 | } |
@@ -1892,7 +1892,7 @@ discard block |
||
1892 | 1892 | protected function _domainCategoryPlural($domain = 'test_plugin', $category = 3) { |
1893 | 1893 | $plurals = array(); |
1894 | 1894 | for ($number = 0; $number <= 25; $number++) { |
1895 | - $plurals[] = sprintf(__dcn($domain, '%d = 1', '%d = 0 or > 1', (float)$number, $category), (float)$number); |
|
1895 | + $plurals[] = sprintf(__dcn($domain, '%d = 1', '%d = 0 or > 1', (float) $number, $category), (float) $number); |
|
1896 | 1896 | } |
1897 | 1897 | return $plurals; |
1898 | 1898 | } |
@@ -1915,7 +1915,7 @@ discard block |
||
1915 | 1915 | protected function _domainPlural($domain = 'test_plugin') { |
1916 | 1916 | $plurals = array(); |
1917 | 1917 | for ($number = 0; $number <= 25; $number++) { |
1918 | - $plurals[] = sprintf(__dn($domain, '%d = 1', '%d = 0 or > 1', (float)$number), (float)$number); |
|
1918 | + $plurals[] = sprintf(__dn($domain, '%d = 1', '%d = 0 or > 1', (float) $number), (float) $number); |
|
1919 | 1919 | } |
1920 | 1920 | return $plurals; |
1921 | 1921 | } |
@@ -1948,7 +1948,7 @@ discard block |
||
1948 | 1948 | protected function _plural() { |
1949 | 1949 | $plurals = array(); |
1950 | 1950 | for ($number = 0; $number <= 25; $number++) { |
1951 | - $plurals[] = sprintf(__n('%d = 1', '%d = 0 or > 1', (float)$number), (float)$number); |
|
1951 | + $plurals[] = sprintf(__n('%d = 1', '%d = 0 or > 1', (float) $number), (float) $number); |
|
1952 | 1952 | } |
1953 | 1953 | return $plurals; |
1954 | 1954 | } |
@@ -1971,7 +1971,7 @@ discard block |
||
1971 | 1971 | protected function _pluralFromCore() { |
1972 | 1972 | $plurals = array(); |
1973 | 1973 | for ($number = 0; $number <= 25; $number++) { |
1974 | - $plurals[] = sprintf(__n('%d = 1 (from core)', '%d = 0 or > 1 (from core)', (float)$number), (float)$number); |
|
1974 | + $plurals[] = sprintf(__n('%d = 1 (from core)', '%d = 0 or > 1 (from core)', (float) $number), (float) $number); |
|
1975 | 1975 | } |
1976 | 1976 | return $plurals; |
1977 | 1977 | } |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * |
106 | 106 | * @param Model $model Model using this behavior |
107 | 107 | * @param array $options Options passed from Model::save(). |
108 | - * @return mixed False if the operation should abort. Any other result will continue. |
|
108 | + * @return boolean|null False if the operation should abort. Any other result will continue. |
|
109 | 109 | * @see Model::save() |
110 | 110 | */ |
111 | 111 | public function beforeSave(Model $model, $options = array()) { |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | * @param Model $model |
131 | 131 | * @param boolean $created |
132 | 132 | * @param array $options Options passed from Model::save(). |
133 | - * @return void |
|
133 | + * @return boolean|null |
|
134 | 134 | */ |
135 | 135 | public function afterSave(Model $model, $created, $options = array()) { |
136 | 136 | $settings = $this->settings[$model->alias]; |
@@ -159,9 +159,9 @@ discard block |
||
159 | 159 | /** |
160 | 160 | * beforeValidate Callback |
161 | 161 | * |
162 | - * @param Model $Model Model invalidFields was called on. |
|
162 | + * @param Model $model Model invalidFields was called on. |
|
163 | 163 | * @param array $options Options passed from Model::save(). |
164 | - * @return boolean |
|
164 | + * @return boolean|null |
|
165 | 165 | * @see Model::save() |
166 | 166 | */ |
167 | 167 | public function beforeValidate(Model $model, $options = array()) { |
@@ -188,8 +188,7 @@ discard block |
||
188 | 188 | * afterValidate method |
189 | 189 | * |
190 | 190 | * @param Model $model |
191 | - * @param boolean $cascade |
|
192 | - * @return void |
|
191 | + * @return boolean|null |
|
193 | 192 | */ |
194 | 193 | public function afterValidate(Model $model) { |
195 | 194 | $settings = $this->settings[$model->alias]; |
@@ -210,7 +209,7 @@ discard block |
||
210 | 209 | * |
211 | 210 | * @param Model $model |
212 | 211 | * @param boolean $cascade |
213 | - * @return void |
|
212 | + * @return boolean|null |
|
214 | 213 | */ |
215 | 214 | public function beforeDelete(Model $model, $cascade = true) { |
216 | 215 | $settings = $this->settings[$model->alias]; |
@@ -267,7 +266,7 @@ discard block |
||
267 | 266 | * beforeTest method |
268 | 267 | * |
269 | 268 | * @param Model $model |
270 | - * @return void |
|
269 | + * @return string |
|
271 | 270 | */ |
272 | 271 | public function beforeTest(Model $model) { |
273 | 272 | if (!isset($model->beforeTestResult)) { |
@@ -282,7 +281,7 @@ discard block |
||
282 | 281 | * |
283 | 282 | * @param Model $model |
284 | 283 | * @param boolean $param |
285 | - * @return void |
|
284 | + * @return string|null |
|
286 | 285 | */ |
287 | 286 | public function testMethod(Model $model, $param = true) { |
288 | 287 | if ($param === true) { |
@@ -294,7 +293,7 @@ discard block |
||
294 | 293 | * testData method |
295 | 294 | * |
296 | 295 | * @param Model $model |
297 | - * @return void |
|
296 | + * @return boolean |
|
298 | 297 | */ |
299 | 298 | public function testData(Model $model) { |
300 | 299 | if (!isset($model->data['Apple']['field'])) { |
@@ -309,7 +308,7 @@ discard block |
||
309 | 308 | * |
310 | 309 | * @param Model $model |
311 | 310 | * @param string|array $field |
312 | - * @return void |
|
311 | + * @return boolean |
|
313 | 312 | */ |
314 | 313 | public function validateField(Model $model, $field) { |
315 | 314 | return current($field) === 'Orange'; |
@@ -321,7 +320,7 @@ discard block |
||
321 | 320 | * @param Model $model |
322 | 321 | * @param string $method |
323 | 322 | * @param string $query |
324 | - * @return void |
|
323 | + * @return string |
|
325 | 324 | */ |
326 | 325 | public function speakEnglish(Model $model, $method, $query) { |
327 | 326 | $method = preg_replace('/look for\s+/', 'Item.name = \'', $method); |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | |
21 | 21 | App::uses('AppModel', 'Model'); |
22 | 22 | |
23 | -require_once dirname(__FILE__) . DS . 'models.php'; |
|
23 | +require_once dirname(__FILE__).DS.'models.php'; |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * TestBehavior class |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | */ |
61 | 61 | public function beforeFind(Model $model, $query) { |
62 | 62 | $settings = $this->settings[$model->alias]; |
63 | - if (!isset($settings['beforeFind']) || $settings['beforeFind'] === 'off') { |
|
63 | + if ( ! isset($settings['beforeFind']) || $settings['beforeFind'] === 'off') { |
|
64 | 64 | return parent::beforeFind($model, $query); |
65 | 65 | } |
66 | 66 | switch ($settings['beforeFind']) { |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | case 'test': |
70 | 70 | return null; |
71 | 71 | case 'modify': |
72 | - $query['fields'] = array($model->alias . '.id', $model->alias . '.name', $model->alias . '.mytime'); |
|
72 | + $query['fields'] = array($model->alias.'.id', $model->alias.'.name', $model->alias.'.mytime'); |
|
73 | 73 | $query['recursive'] = -1; |
74 | 74 | return $query; |
75 | 75 | } |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | */ |
86 | 86 | public function afterFind(Model $model, $results, $primary = false) { |
87 | 87 | $settings = $this->settings[$model->alias]; |
88 | - if (!isset($settings['afterFind']) || $settings['afterFind'] === 'off') { |
|
88 | + if ( ! isset($settings['afterFind']) || $settings['afterFind'] === 'off') { |
|
89 | 89 | return parent::afterFind($model, $results, $primary); |
90 | 90 | } |
91 | 91 | switch ($settings['afterFind']) { |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | */ |
111 | 111 | public function beforeSave(Model $model, $options = array()) { |
112 | 112 | $settings = $this->settings[$model->alias]; |
113 | - if (!isset($settings['beforeSave']) || $settings['beforeSave'] === 'off') { |
|
113 | + if ( ! isset($settings['beforeSave']) || $settings['beforeSave'] === 'off') { |
|
114 | 114 | return parent::beforeSave($model, $options); |
115 | 115 | } |
116 | 116 | switch ($settings['beforeSave']) { |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | */ |
135 | 135 | public function afterSave(Model $model, $created, $options = array()) { |
136 | 136 | $settings = $this->settings[$model->alias]; |
137 | - if (!isset($settings['afterSave']) || $settings['afterSave'] === 'off') { |
|
137 | + if ( ! isset($settings['afterSave']) || $settings['afterSave'] === 'off') { |
|
138 | 138 | return parent::afterSave($model, $created, $options); |
139 | 139 | } |
140 | 140 | $string = 'modified after'; |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | case 'test2': |
152 | 152 | return false; |
153 | 153 | case 'modify': |
154 | - $model->data[$model->alias]['name'] .= ' ' . $string; |
|
154 | + $model->data[$model->alias]['name'] .= ' '.$string; |
|
155 | 155 | break; |
156 | 156 | } |
157 | 157 | } |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | */ |
167 | 167 | public function beforeValidate(Model $model, $options = array()) { |
168 | 168 | $settings = $this->settings[$model->alias]; |
169 | - if (!isset($settings['validate']) || $settings['validate'] === 'off') { |
|
169 | + if ( ! isset($settings['validate']) || $settings['validate'] === 'off') { |
|
170 | 170 | return parent::beforeValidate($model, $options); |
171 | 171 | } |
172 | 172 | switch ($settings['validate']) { |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | */ |
194 | 194 | public function afterValidate(Model $model) { |
195 | 195 | $settings = $this->settings[$model->alias]; |
196 | - if (!isset($settings['afterValidate']) || $settings['afterValidate'] === 'off') { |
|
196 | + if ( ! isset($settings['afterValidate']) || $settings['afterValidate'] === 'off') { |
|
197 | 197 | return parent::afterValidate($model); |
198 | 198 | } |
199 | 199 | switch ($settings['afterValidate']) { |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | */ |
215 | 215 | public function beforeDelete(Model $model, $cascade = true) { |
216 | 216 | $settings = $this->settings[$model->alias]; |
217 | - if (!isset($settings['beforeDelete']) || $settings['beforeDelete'] === 'off') { |
|
217 | + if ( ! isset($settings['beforeDelete']) || $settings['beforeDelete'] === 'off') { |
|
218 | 218 | return parent::beforeDelete($model, $cascade); |
219 | 219 | } |
220 | 220 | switch ($settings['beforeDelete']) { |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | */ |
240 | 240 | public function afterDelete(Model $model) { |
241 | 241 | $settings = $this->settings[$model->alias]; |
242 | - if (!isset($settings['afterDelete']) || $settings['afterDelete'] === 'off') { |
|
242 | + if ( ! isset($settings['afterDelete']) || $settings['afterDelete'] === 'off') { |
|
243 | 243 | return parent::afterDelete($model); |
244 | 244 | } |
245 | 245 | switch ($settings['afterDelete']) { |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | */ |
258 | 258 | public function onError(Model $model, $error) { |
259 | 259 | $settings = $this->settings[$model->alias]; |
260 | - if (!isset($settings['onError']) || $settings['onError'] === 'off') { |
|
260 | + if ( ! isset($settings['onError']) || $settings['onError'] === 'off') { |
|
261 | 261 | return parent::onError($model, $error); |
262 | 262 | } |
263 | 263 | echo "onError trigger success"; |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | * @return void |
271 | 271 | */ |
272 | 272 | public function beforeTest(Model $model) { |
273 | - if (!isset($model->beforeTestResult)) { |
|
273 | + if ( ! isset($model->beforeTestResult)) { |
|
274 | 274 | $model->beforeTestResult = array(); |
275 | 275 | } |
276 | 276 | $model->beforeTestResult[] = strtolower(get_class($this)); |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | * @return void |
298 | 298 | */ |
299 | 299 | public function testData(Model $model) { |
300 | - if (!isset($model->data['Apple']['field'])) { |
|
300 | + if ( ! isset($model->data['Apple']['field'])) { |
|
301 | 301 | return false; |
302 | 302 | } |
303 | 303 | $model->data['Apple']['field_2'] = true; |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | public function speakEnglish(Model $model, $method, $query) { |
327 | 327 | $method = preg_replace('/look for\s+/', 'Item.name = \'', $method); |
328 | 328 | $query = preg_replace('/^in\s+/', 'Location.name = \'', $query); |
329 | - return $method . '\' AND ' . $query . '\''; |
|
329 | + return $method.'\' AND '.$query.'\''; |
|
330 | 330 | } |
331 | 331 | |
332 | 332 | } |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | $this->assertEquals('working', $Apple->testMethod(true)); |
506 | 506 | $this->assertEquals('working', $Apple->Behaviors->dispatchMethod($Apple, 'testMethod')); |
507 | 507 | |
508 | - App::build(array('Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS))); |
|
508 | + App::build(array('Plugin' => array(CAKE.'Test'.DS.'test_app'.DS.'Plugin'.DS))); |
|
509 | 509 | CakePlugin::load('TestPlugin'); |
510 | 510 | $this->assertTrue($Apple->Behaviors->load('SomeOther', array('className' => 'TestPlugin.TestPluginPersisterOne'))); |
511 | 511 | $this->assertInstanceOf('TestPluginPersisterOneBehavior', $Apple->Behaviors->SomeOther); |
@@ -27,10 +27,16 @@ |
||
27 | 27 | */ |
28 | 28 | class TestCakeSession extends CakeSession { |
29 | 29 | |
30 | + /** |
|
31 | + * @param string $value |
|
32 | + */ |
|
30 | 33 | public static function setUserAgent($value) { |
31 | 34 | self::$_userAgent = $value; |
32 | 35 | } |
33 | 36 | |
37 | + /** |
|
38 | + * @param string $host |
|
39 | + */ |
|
34 | 40 | public static function setHost($host) { |
35 | 41 | self::_setHost($host); |
36 | 42 | } |
@@ -474,7 +474,7 @@ discard block |
||
474 | 474 | */ |
475 | 475 | public function testCheckUserAgentFalse() { |
476 | 476 | Configure::write('Session.checkAgent', false); |
477 | - TestCakeSession::setUserAgent(md5('http://randomdomainname.com' . Configure::read('Security.salt'))); |
|
477 | + TestCakeSession::setUserAgent(md5('http://randomdomainname.com'.Configure::read('Security.salt'))); |
|
478 | 478 | $this->assertTrue(TestCakeSession::valid()); |
479 | 479 | } |
480 | 480 | |
@@ -486,7 +486,7 @@ discard block |
||
486 | 486 | public function testCheckUserAgentTrue() { |
487 | 487 | Configure::write('Session.checkAgent', true); |
488 | 488 | TestCakeSession::$error = false; |
489 | - $agent = md5('http://randomdomainname.com' . Configure::read('Security.salt')); |
|
489 | + $agent = md5('http://randomdomainname.com'.Configure::read('Security.salt')); |
|
490 | 490 | |
491 | 491 | TestCakeSession::write('Config.userAgent', md5('Hacking you!')); |
492 | 492 | TestCakeSession::setUserAgent($agent); |
@@ -536,9 +536,9 @@ discard block |
||
536 | 536 | public function testUsingAppLibsHandler() { |
537 | 537 | App::build(array( |
538 | 538 | 'Model/Datasource/Session' => array( |
539 | - CAKE . 'Test' . DS . 'test_app' . DS . 'Model' . DS . 'Datasource' . DS . 'Session' . DS |
|
539 | + CAKE.'Test'.DS.'test_app'.DS.'Model'.DS.'Datasource'.DS.'Session'.DS |
|
540 | 540 | ), |
541 | - 'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS) |
|
541 | + 'Plugin' => array(CAKE.'Test'.DS.'test_app'.DS.'Plugin'.DS) |
|
542 | 542 | ), App::RESET); |
543 | 543 | Configure::write('Session', array( |
544 | 544 | 'defaults' => 'cake', |
@@ -563,7 +563,7 @@ discard block |
||
563 | 563 | */ |
564 | 564 | public function testUsingPluginHandler() { |
565 | 565 | App::build(array( |
566 | - 'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS) |
|
566 | + 'Plugin' => array(CAKE.'Test'.DS.'test_app'.DS.'Plugin'.DS) |
|
567 | 567 | ), App::RESET); |
568 | 568 | CakePlugin::load('TestPlugin'); |
569 | 569 |
@@ -59,8 +59,7 @@ |
||
59 | 59 | /** |
60 | 60 | * fetchAll method |
61 | 61 | * |
62 | - * @param mixed $sql |
|
63 | - * @return void |
|
62 | + * @return string |
|
64 | 63 | */ |
65 | 64 | protected function _matchRecords(Model $model, $conditions = null) { |
66 | 65 | return $this->conditions(array('id' => array(1, 2))); |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | App::uses('AppModel', 'Model'); |
21 | 21 | App::uses('Sqlserver', 'Model/Datasource/Database'); |
22 | 22 | |
23 | -require_once dirname(dirname(dirname(__FILE__))) . DS . 'models.php'; |
|
23 | +require_once dirname(dirname(dirname(__FILE__))).DS.'models.php'; |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * SqlserverTestDb class |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | * @return void |
222 | 222 | */ |
223 | 223 | public function fetch() { |
224 | - if (!$this->valid()) { |
|
224 | + if ( ! $this->valid()) { |
|
225 | 225 | return null; |
226 | 226 | } |
227 | 227 | $current = $this->current(); |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | public function setUp() { |
268 | 268 | parent::setUp(); |
269 | 269 | $this->Dbo = ConnectionManager::getDataSource('test'); |
270 | - if (!($this->Dbo instanceof Sqlserver)) { |
|
270 | + if ( ! ($this->Dbo instanceof Sqlserver)) { |
|
271 | 271 | $this->markTestSkipped('Please configure the test datasource to use SQL Server.'); |
272 | 272 | } |
273 | 273 | $this->db = new SqlserverTestDb($this->Dbo->config); |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | */ |
407 | 407 | public function testDescribe() { |
408 | 408 | $SqlserverTableDescription = new SqlserverTestResultIterator(array( |
409 | - (object)array( |
|
409 | + (object) array( |
|
410 | 410 | 'Default' => '((0))', |
411 | 411 | 'Field' => 'count', |
412 | 412 | 'Key' => 0, |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | 'Null' => 'NO', |
415 | 415 | 'Type' => 'integer' |
416 | 416 | ), |
417 | - (object)array( |
|
417 | + (object) array( |
|
418 | 418 | 'Default' => '', |
419 | 419 | 'Field' => 'body', |
420 | 420 | 'Key' => 0, |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | 'Null' => 'YES', |
423 | 423 | 'Type' => 'nvarchar' |
424 | 424 | ), |
425 | - (object)array( |
|
425 | + (object) array( |
|
426 | 426 | 'Default' => '', |
427 | 427 | 'Field' => 'published', |
428 | 428 | 'Key' => 0, |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | 'Null' => 'YES', |
432 | 432 | 'Size' => '' |
433 | 433 | ), |
434 | - (object)array( |
|
434 | + (object) array( |
|
435 | 435 | 'Default' => '', |
436 | 436 | 'Field' => 'id', |
437 | 437 | 'Key' => 1, |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | 'Null' => 'NO', |
441 | 441 | 'Size' => '' |
442 | 442 | ), |
443 | - (object)array( |
|
443 | + (object) array( |
|
444 | 444 | 'Default' => null, |
445 | 445 | 'Field' => 'parent_id', |
446 | 446 | 'Key' => '0', |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | /** |
58 | 58 | * listSources |
59 | 59 | * |
60 | - * @return boolean |
|
60 | + * @return string[] |
|
61 | 61 | */ |
62 | 62 | public function listSources() { |
63 | 63 | return null; |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | /** |
67 | 67 | * Returns the schema for the datasource to enable create/update |
68 | 68 | * |
69 | - * @param object $Model |
|
69 | + * @param Model $Model |
|
70 | 70 | * @return array |
71 | 71 | */ |
72 | 72 | public function describe(Model $Model) { |
@@ -241,7 +241,7 @@ |
||
241 | 241 | ->method('delete') |
242 | 242 | ->with( |
243 | 243 | $this->equalTo($this->Model), |
244 | - $this->equalTo(array($this->Model->alias . '.id' => 1)) |
|
244 | + $this->equalTo(array($this->Model->alias.'.id' => 1)) |
|
245 | 245 | ); |
246 | 246 | $this->Model->delete(1); |
247 | 247 | } |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | * |
170 | 170 | * @param mixed $value |
171 | 171 | * @param mixed $options |
172 | - * @return void |
|
172 | + * @return boolean |
|
173 | 173 | */ |
174 | 174 | public function validateNumber($value, $options) { |
175 | 175 | $options = array_merge(array('min' => 0, 'max' => 100), $options); |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | * validateTitle method |
182 | 182 | * |
183 | 183 | * @param mixed $value |
184 | - * @return void |
|
184 | + * @return boolean |
|
185 | 185 | */ |
186 | 186 | public function validateTitle($value) { |
187 | 187 | return (!empty($value) && strpos(strtolower($value['title']), 'title-') === 0); |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | /** |
284 | 284 | * beforeSave method |
285 | 285 | * |
286 | - * @return void |
|
286 | + * @return boolean |
|
287 | 287 | */ |
288 | 288 | public function beforeSave($options = array()) { |
289 | 289 | return $this->beforeSaveReturn; |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | * titleDuplicate method |
294 | 294 | * |
295 | 295 | * @param string $title |
296 | - * @return void |
|
296 | + * @return boolean |
|
297 | 297 | */ |
298 | 298 | public static function titleDuplicate($title) { |
299 | 299 | if ($title === 'My Article Title') { |
@@ -2164,7 +2164,7 @@ discard block |
||
2164 | 2164 | * customValidationMethod method |
2165 | 2165 | * |
2166 | 2166 | * @param mixed $data |
2167 | - * @return void |
|
2167 | + * @return boolean |
|
2168 | 2168 | */ |
2169 | 2169 | public function customValidationMethod($data) { |
2170 | 2170 | return $data === 1; |
@@ -2173,7 +2173,7 @@ discard block |
||
2173 | 2173 | /** |
2174 | 2174 | * Custom validator with parameters + default values |
2175 | 2175 | * |
2176 | - * @return array |
|
2176 | + * @return boolean |
|
2177 | 2177 | */ |
2178 | 2178 | public function customValidatorWithParams($data, $validator, $or = true, $ignoreOnSame = 'id') { |
2179 | 2179 | $this->validatorParams = get_defined_vars(); |
@@ -2184,7 +2184,7 @@ discard block |
||
2184 | 2184 | /** |
2185 | 2185 | * Custom validator with message |
2186 | 2186 | * |
2187 | - * @return array |
|
2187 | + * @return string |
|
2188 | 2188 | */ |
2189 | 2189 | public function customValidatorWithMessage($data) { |
2190 | 2190 | return 'This field will *never* validate! Muhahaha!'; |
@@ -2193,7 +2193,7 @@ discard block |
||
2193 | 2193 | /** |
2194 | 2194 | * Test validation with many parameters |
2195 | 2195 | * |
2196 | - * @return void |
|
2196 | + * @return boolean |
|
2197 | 2197 | */ |
2198 | 2198 | public function customValidatorWithSixParams($data, $one = 1, $two = 2, $three = 3, $four = 4, $five = 5, $six = 6) { |
2199 | 2199 | $this->validatorParams = get_defined_vars(); |
@@ -2243,7 +2243,7 @@ discard block |
||
2243 | 2243 | * customValidationMethod method |
2244 | 2244 | * |
2245 | 2245 | * @param mixed $data |
2246 | - * @return void |
|
2246 | + * @return boolean |
|
2247 | 2247 | */ |
2248 | 2248 | public function customValidationMethod($data) { |
2249 | 2249 | return $data === 1; |
@@ -2553,7 +2553,7 @@ discard block |
||
2553 | 2553 | * @param integer $levelLimit |
2554 | 2554 | * @param integer $childLimit |
2555 | 2555 | * @param mixed $currentLevel |
2556 | - * @param mixed $parent_id |
|
2556 | + * @param mixed $parentId |
|
2557 | 2557 | * @param string $prefix |
2558 | 2558 | * @param boolean $hierarchal |
2559 | 2559 | * @return void |
@@ -4995,7 +4995,7 @@ discard block |
||
4995 | 4995 | * Alters title data |
4996 | 4996 | * |
4997 | 4997 | * @param array $options Options passed from Model::save(). |
4998 | - * @return boolean True if validate operation should continue, false to abort |
|
4998 | + * @return boolean|null True if validate operation should continue, false to abort |
|
4999 | 4999 | * @see Model::save() |
5000 | 5000 | */ |
5001 | 5001 | public function beforeValidate($options = array()) { |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | * @return void |
185 | 185 | */ |
186 | 186 | public function validateTitle($value) { |
187 | - return (!empty($value) && strpos(strtolower($value['title']), 'title-') === 0); |
|
187 | + return ( ! empty($value) && strpos(strtolower($value['title']), 'title-') === 0); |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | } |
@@ -217,8 +217,8 @@ discard block |
||
217 | 217 | * @throws Exception |
218 | 218 | */ |
219 | 219 | public function beforeFind($queryData) { |
220 | - if (!empty($queryData['lazyLoad'])) { |
|
221 | - if (!isset($this->Article, $this->Comment, $this->ArticleFeatured)) { |
|
220 | + if ( ! empty($queryData['lazyLoad'])) { |
|
221 | + if ( ! isset($this->Article, $this->Comment, $this->ArticleFeatured)) { |
|
222 | 222 | throw new Exception('Unavailable associations'); |
223 | 223 | } |
224 | 224 | } |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | |
319 | 319 | public function beforeDelete($cascade = true) { |
320 | 320 | $db = $this->getDataSource(); |
321 | - $db->delete($this, array($this->alias . '.' . $this->primaryKey => array(1, 3))); |
|
321 | + $db->delete($this, array($this->alias.'.'.$this->primaryKey => array(1, 3))); |
|
322 | 322 | return true; |
323 | 323 | } |
324 | 324 | |
@@ -2559,7 +2559,7 @@ discard block |
||
2559 | 2559 | * @return void |
2560 | 2560 | */ |
2561 | 2561 | public function initialize($levelLimit = 3, $childLimit = 3, $currentLevel = null, $parentId = null, $prefix = '1', $hierarchal = true) { |
2562 | - if (!$parentId) { |
|
2562 | + if ( ! $parentId) { |
|
2563 | 2563 | $db = ConnectionManager::getDataSource($this->useDbConfig); |
2564 | 2564 | $db->truncate($this->table); |
2565 | 2565 | $this->save(array($this->name => array('name' => '1. Root'))); |
@@ -2567,12 +2567,12 @@ discard block |
||
2567 | 2567 | $this->create(array()); |
2568 | 2568 | } |
2569 | 2569 | |
2570 | - if (!$currentLevel || $currentLevel > $levelLimit) { |
|
2570 | + if ( ! $currentLevel || $currentLevel > $levelLimit) { |
|
2571 | 2571 | return; |
2572 | 2572 | } |
2573 | 2573 | |
2574 | 2574 | for ($i = 1; $i <= $childLimit; $i++) { |
2575 | - $name = $prefix . '.' . $i; |
|
2575 | + $name = $prefix.'.'.$i; |
|
2576 | 2576 | $data = array($this->name => array('name' => $name)); |
2577 | 2577 | $this->create($data); |
2578 | 2578 | |
@@ -3721,7 +3721,7 @@ discard block |
||
3721 | 3721 | * @return void |
3722 | 3722 | */ |
3723 | 3723 | public function schema($field = false) { |
3724 | - if (!isset($this->_schema)) { |
|
3724 | + if ( ! isset($this->_schema)) { |
|
3725 | 3725 | $this->_schema = array( |
3726 | 3726 | 'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'), |
3727 | 3727 | 'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'), |
@@ -3768,7 +3768,7 @@ discard block |
||
3768 | 3768 | * @return void |
3769 | 3769 | */ |
3770 | 3770 | public function schema($field = false) { |
3771 | - if (!isset($this->_schema)) { |
|
3771 | + if ( ! isset($this->_schema)) { |
|
3772 | 3772 | $this->_schema = array( |
3773 | 3773 | 'test_model4_id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'), |
3774 | 3774 | 'test_model7_id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8') |
@@ -3833,7 +3833,7 @@ discard block |
||
3833 | 3833 | * @return void |
3834 | 3834 | */ |
3835 | 3835 | public function schema($field = false) { |
3836 | - if (!isset($this->_schema)) { |
|
3836 | + if ( ! isset($this->_schema)) { |
|
3837 | 3837 | $this->_schema = array( |
3838 | 3838 | 'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'), |
3839 | 3839 | 'test_model4_id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'), |
@@ -3893,7 +3893,7 @@ discard block |
||
3893 | 3893 | * @return void |
3894 | 3894 | */ |
3895 | 3895 | public function schema($field = false) { |
3896 | - if (!isset($this->_schema)) { |
|
3896 | + if ( ! isset($this->_schema)) { |
|
3897 | 3897 | $this->_schema = array( |
3898 | 3898 | 'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'), |
3899 | 3899 | 'test_model5_id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'), |
@@ -3941,7 +3941,7 @@ discard block |
||
3941 | 3941 | * @return void |
3942 | 3942 | */ |
3943 | 3943 | public function schema($field = false) { |
3944 | - if (!isset($this->_schema)) { |
|
3944 | + if ( ! isset($this->_schema)) { |
|
3945 | 3945 | $this->_schema = array( |
3946 | 3946 | 'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'), |
3947 | 3947 | 'name' => array('type' => 'string', 'null' => '', 'default' => '', 'length' => '255'), |
@@ -4001,7 +4001,7 @@ discard block |
||
4001 | 4001 | * @return void |
4002 | 4002 | */ |
4003 | 4003 | public function schema($field = false) { |
4004 | - if (!isset($this->_schema)) { |
|
4004 | + if ( ! isset($this->_schema)) { |
|
4005 | 4005 | $this->_schema = array( |
4006 | 4006 | 'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'), |
4007 | 4007 | 'test_model9_id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'), |
@@ -4062,7 +4062,7 @@ discard block |
||
4062 | 4062 | * @return void |
4063 | 4063 | */ |
4064 | 4064 | public function schema($field = false) { |
4065 | - if (!isset($this->_schema)) { |
|
4065 | + if ( ! isset($this->_schema)) { |
|
4066 | 4066 | $this->_schema = array( |
4067 | 4067 | 'id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '8'), |
4068 | 4068 | 'test_model8_id' => array('type' => 'integer', 'null' => '', 'default' => '', 'length' => '11'), |
@@ -4124,7 +4124,7 @@ discard block |
||
4124 | 4124 | * @return void |
4125 | 4125 | */ |
4126 | 4126 | public function schema($field = false) { |
4127 | - if (!isset($this->_schema)) { |
|
4127 | + if ( ! isset($this->_schema)) { |
|
4128 | 4128 | $this->_schema = array( |
4129 | 4129 | 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => '10'), |
4130 | 4130 | 'name' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => '20'), |
@@ -4183,7 +4183,7 @@ discard block |
||
4183 | 4183 | * @return void |
4184 | 4184 | */ |
4185 | 4185 | public function schema($field = false) { |
4186 | - if (!isset($this->_schema)) { |
|
4186 | + if ( ! isset($this->_schema)) { |
|
4187 | 4187 | $this->_schema = array( |
4188 | 4188 | 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => '10'), |
4189 | 4189 | 'level_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => '10'), |
@@ -4254,7 +4254,7 @@ discard block |
||
4254 | 4254 | * @return void |
4255 | 4255 | */ |
4256 | 4256 | public function schema($field = false) { |
4257 | - if (!isset($this->_schema)) { |
|
4257 | + if ( ! isset($this->_schema)) { |
|
4258 | 4258 | $this->_schema = array( |
4259 | 4259 | 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => '10'), |
4260 | 4260 | 'group_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => '10'), |
@@ -4334,7 +4334,7 @@ discard block |
||
4334 | 4334 | * @return void |
4335 | 4335 | */ |
4336 | 4336 | public function schema($field = false) { |
4337 | - if (!isset($this->_schema)) { |
|
4337 | + if ( ! isset($this->_schema)) { |
|
4338 | 4338 | $this->_schema = array( |
4339 | 4339 | 'id' => array('type' => 'integer', 'null' => false, 'default' => '', 'length' => '10'), |
4340 | 4340 | 'group_id' => array('type' => 'integer', 'null' => false, 'default' => '', 'length' => '10'), |
@@ -4394,7 +4394,7 @@ discard block |
||
4394 | 4394 | * @return void |
4395 | 4395 | */ |
4396 | 4396 | public function schema($field = false) { |
4397 | - if (!isset($this->_schema)) { |
|
4397 | + if ( ! isset($this->_schema)) { |
|
4398 | 4398 | $this->_schema = array( |
4399 | 4399 | 'id' => array('type' => 'integer', 'null' => false, 'default' => '', 'length' => '10'), |
4400 | 4400 | 'category_id' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'), |
@@ -4456,7 +4456,7 @@ discard block |
||
4456 | 4456 | * @return void |
4457 | 4457 | */ |
4458 | 4458 | public function schema($field = false) { |
4459 | - if (!isset($this->_schema)) { |
|
4459 | + if ( ! isset($this->_schema)) { |
|
4460 | 4460 | $this->_schema = array( |
4461 | 4461 | 'id' => array('type' => 'integer', 'null' => false, 'default' => '', 'length' => '10'), |
4462 | 4462 | 'parent_id' => array('type' => 'integer', 'null' => false, 'default' => '', 'length' => '10'), |
@@ -4515,7 +4515,7 @@ discard block |
||
4515 | 4515 | * @return void |
4516 | 4516 | */ |
4517 | 4517 | public function schema($field = false) { |
4518 | - if (!isset($this->_schema)) { |
|
4518 | + if ( ! isset($this->_schema)) { |
|
4519 | 4519 | $this->_schema = array( |
4520 | 4520 | 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => '10'), |
4521 | 4521 | 'article_id' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'), |
@@ -4569,7 +4569,7 @@ discard block |
||
4569 | 4569 | * @return void |
4570 | 4570 | */ |
4571 | 4571 | public function schema($field = false) { |
4572 | - if (!isset($this->_schema)) { |
|
4572 | + if ( ! isset($this->_schema)) { |
|
4573 | 4573 | $this->_schema = array( |
4574 | 4574 | 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => '10'), |
4575 | 4575 | 'article_featured_id' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'), |
@@ -4644,7 +4644,7 @@ discard block |
||
4644 | 4644 | * @return void |
4645 | 4645 | */ |
4646 | 4646 | public function schema($field = false) { |
4647 | - if (!isset($this->_schema)) { |
|
4647 | + if ( ! isset($this->_schema)) { |
|
4648 | 4648 | $this->_schema = array( |
4649 | 4649 | 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => '10'), |
4650 | 4650 | 'category_featured_id' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => '10'), |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | /** |
52 | 52 | * Wrap to protected method |
53 | 53 | * |
54 | - * @return array |
|
54 | + * @return string[] |
|
55 | 55 | */ |
56 | 56 | public function wrap($text, $length = CakeEmail::LINE_LENGTH_MUST) { |
57 | 57 | return parent::_wrap($text, $length); |
@@ -1981,6 +1981,9 @@ discard block |
||
1981 | 1981 | $this->assertContains(mb_convert_encoding('①㈱', 'ISO-2022-JP-MS'), $result['message']); |
1982 | 1982 | } |
1983 | 1983 | |
1984 | + /** |
|
1985 | + * @param string $charset |
|
1986 | + */ |
|
1984 | 1987 | protected function _checkContentTransferEncoding($message, $charset) { |
1985 | 1988 | $boundary = '--alt-' . $this->CakeEmail->getBoundary(); |
1986 | 1989 | $result['text'] = false; |
@@ -2119,8 +2122,8 @@ discard block |
||
2119 | 2122 | } |
2120 | 2123 | |
2121 | 2124 | /** |
2122 | - * @param mixed $charset |
|
2123 | - * @param mixed $headerCharset |
|
2125 | + * @param string $charset |
|
2126 | + * @param null|string $headerCharset |
|
2124 | 2127 | * @return CakeEmail |
2125 | 2128 | */ |
2126 | 2129 | protected function _getEmailByOldStyleCharset($charset, $headerCharset) { |
@@ -2143,8 +2146,8 @@ discard block |
||
2143 | 2146 | } |
2144 | 2147 | |
2145 | 2148 | /** |
2146 | - * @param mixed $charset |
|
2147 | - * @param mixed $headerCharset |
|
2149 | + * @param string $charset |
|
2150 | + * @param null|string $headerCharset |
|
2148 | 2151 | * @return CakeEmail |
2149 | 2152 | */ |
2150 | 2153 | protected function _getEmailByNewStyleCharset($charset, $headerCharset) { |
@@ -1202,10 +1202,10 @@ |
||
1202 | 1202 | $this->assertContains('--' . $boundary . '--', $result['message']); |
1203 | 1203 | } |
1204 | 1204 | /** |
1205 | - * testSendWithLog method |
|
1206 | - * |
|
1207 | - * @return void |
|
1208 | - */ |
|
1205 | + * testSendWithLog method |
|
1206 | + * |
|
1207 | + * @return void |
|
1208 | + */ |
|
1209 | 1209 | public function testSendWithLog() { |
1210 | 1210 | CakeLog::config('email', array( |
1211 | 1211 | 'engine' => 'File', |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | $this->CakeEmail = new TestCakeEmail(); |
149 | 149 | |
150 | 150 | App::build(array( |
151 | - 'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS) |
|
151 | + 'View' => array(CAKE.'Test'.DS.'test_app'.DS.'View'.DS) |
|
152 | 152 | )); |
153 | 153 | } |
154 | 154 | |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | * @return void |
427 | 427 | */ |
428 | 428 | public function testFormatAddressJapanese() { |
429 | - $this->skipIf(!function_exists('mb_convert_encoding')); |
|
429 | + $this->skipIf( ! function_exists('mb_convert_encoding')); |
|
430 | 430 | |
431 | 431 | $this->CakeEmail->headerCharset = 'ISO-2022-JP'; |
432 | 432 | $result = $this->CakeEmail->formatAddress(array('[email protected]' => '日本語Test')); |
@@ -434,11 +434,11 @@ discard block |
||
434 | 434 | $this->assertSame($expected, $result); |
435 | 435 | |
436 | 436 | $result = $this->CakeEmail->formatAddress(array('[email protected]' => '寿限無寿限無五劫の擦り切れ海砂利水魚の水行末雲来末風来末食う寝る処に住む処やぶら小路の藪柑子パイポパイポパイポのシューリンガンシューリンガンのグーリンダイグーリンダイのポンポコピーのポンポコナーの長久命の長助')); |
437 | - $expected = array("=?ISO-2022-JP?B?GyRCPHc4Qkw1PHc4Qkw1OF45ZSROOyQkakBaJGwzJDo9TXg/ZTV7GyhC?=\r\n" . |
|
438 | - " =?ISO-2022-JP?B?GyRCJE4/ZTlUS3YxQE1oS3ZJd01oS3Y/KSQmPzIkaz1oJEs9OyRgGyhC?=\r\n" . |
|
439 | - " =?ISO-2022-JP?B?GyRCPWgkZCRWJGk+Lk8pJE5pLjQ7O1IlUSUkJV0lUSUkJV0lUSUkGyhC?=\r\n" . |
|
440 | - " =?ISO-2022-JP?B?GyRCJV0kTiU3JWUhPCVqJXMlLCVzJTclZSE8JWolcyUsJXMkTiUwGyhC?=\r\n" . |
|
441 | - " =?ISO-2022-JP?B?GyRCITwlaiVzJUAlJCUwITwlaiVzJUAlJCROJV0lcyVdJTMlVCE8GyhC?=\r\n" . |
|
437 | + $expected = array("=?ISO-2022-JP?B?GyRCPHc4Qkw1PHc4Qkw1OF45ZSROOyQkakBaJGwzJDo9TXg/ZTV7GyhC?=\r\n". |
|
438 | + " =?ISO-2022-JP?B?GyRCJE4/ZTlUS3YxQE1oS3ZJd01oS3Y/KSQmPzIkaz1oJEs9OyRgGyhC?=\r\n". |
|
439 | + " =?ISO-2022-JP?B?GyRCPWgkZCRWJGk+Lk8pJE5pLjQ7O1IlUSUkJV0lUSUkJV0lUSUkGyhC?=\r\n". |
|
440 | + " =?ISO-2022-JP?B?GyRCJV0kTiU3JWUhPCVqJXMlLCVzJTclZSE8JWolcyUsJXMkTiUwGyhC?=\r\n". |
|
441 | + " =?ISO-2022-JP?B?GyRCITwlaiVzJUAlJCUwITwlaiVzJUAlJCROJV0lcyVdJTMlVCE8GyhC?=\r\n". |
|
442 | 442 | " =?ISO-2022-JP?B?GyRCJE4lXSVzJV0lMyVKITwkTkQ5NVdMPyRORDk9dRsoQg==?= <[email protected]>"); |
443 | 443 | $this->assertSame($expected, $result); |
444 | 444 | } |
@@ -563,7 +563,7 @@ discard block |
||
563 | 563 | $this->assertSame($this->CakeEmail->subject(), '1'); |
564 | 564 | |
565 | 565 | $this->CakeEmail->subject('هذه رسالة بعنوان طويل مرسل للمستلم'); |
566 | - $expected = '=?UTF-8?B?2YfYsNmHINix2LPYp9mE2Kkg2KjYudmG2YjYp9mGINi32YjZitmEINmF2LE=?=' . "\r\n" . ' =?UTF-8?B?2LPZhCDZhNmE2YXYs9iq2YTZhQ==?='; |
|
566 | + $expected = '=?UTF-8?B?2YfYsNmHINix2LPYp9mE2Kkg2KjYudmG2YjYp9mGINi32YjZitmEINmF2LE=?='."\r\n".' =?UTF-8?B?2LPZhCDZhNmE2YXYs9iq2YTZhQ==?='; |
|
567 | 567 | $this->assertSame($this->CakeEmail->subject(), $expected); |
568 | 568 | } |
569 | 569 | |
@@ -573,7 +573,7 @@ discard block |
||
573 | 573 | * @return void |
574 | 574 | */ |
575 | 575 | public function testSubjectJapanese() { |
576 | - $this->skipIf(!function_exists('mb_convert_encoding')); |
|
576 | + $this->skipIf( ! function_exists('mb_convert_encoding')); |
|
577 | 577 | mb_internal_encoding('UTF-8'); |
578 | 578 | |
579 | 579 | $this->CakeEmail->headerCharset = 'ISO-2022-JP'; |
@@ -582,8 +582,8 @@ discard block |
||
582 | 582 | $this->assertSame($this->CakeEmail->subject(), $expected); |
583 | 583 | |
584 | 584 | $this->CakeEmail->subject('長い長い長いSubjectの場合はfoldingするのが正しいんだけどいったいどうなるんだろう?'); |
585 | - $expected = "=?ISO-2022-JP?B?GyRCRDkkJEQ5JCREOSQkGyhCU3ViamVjdBskQiROPmw5ZyRPGyhCZm9s?=\r\n" . |
|
586 | - " =?ISO-2022-JP?B?ZGluZxskQiQ5JGskTiQsQDUkNyQkJHMkQCQxJEkkJCRDJD8kJCRJGyhC?=\r\n" . |
|
585 | + $expected = "=?ISO-2022-JP?B?GyRCRDkkJEQ5JCREOSQkGyhCU3ViamVjdBskQiROPmw5ZyRPGyhCZm9s?=\r\n". |
|
586 | + " =?ISO-2022-JP?B?ZGluZxskQiQ5JGskTiQsQDUkNyQkJHMkQCQxJEkkJCRDJD8kJCRJGyhC?=\r\n". |
|
587 | 587 | " =?ISO-2022-JP?B?GyRCJCYkSiRrJHMkQCRtJCYhKRsoQg==?="; |
588 | 588 | $this->assertSame($this->CakeEmail->subject(), $expected); |
589 | 589 | } |
@@ -766,10 +766,10 @@ discard block |
||
766 | 766 | * @return void |
767 | 767 | */ |
768 | 768 | public function testAttachments() { |
769 | - $this->CakeEmail->attachments(CAKE . 'basics.php'); |
|
769 | + $this->CakeEmail->attachments(CAKE.'basics.php'); |
|
770 | 770 | $expected = array( |
771 | 771 | 'basics.php' => array( |
772 | - 'file' => CAKE . 'basics.php', |
|
772 | + 'file' => CAKE.'basics.php', |
|
773 | 773 | 'mimetype' => 'application/octet-stream' |
774 | 774 | ) |
775 | 775 | ); |
@@ -779,21 +779,21 @@ discard block |
||
779 | 779 | $this->assertSame($this->CakeEmail->attachments(), array()); |
780 | 780 | |
781 | 781 | $this->CakeEmail->attachments(array( |
782 | - array('file' => CAKE . 'basics.php', 'mimetype' => 'text/plain') |
|
782 | + array('file' => CAKE.'basics.php', 'mimetype' => 'text/plain') |
|
783 | 783 | )); |
784 | - $this->CakeEmail->addAttachments(CAKE . 'bootstrap.php'); |
|
785 | - $this->CakeEmail->addAttachments(array(CAKE . 'bootstrap.php')); |
|
786 | - $this->CakeEmail->addAttachments(array('other.txt' => CAKE . 'bootstrap.php', 'license' => CAKE . 'LICENSE.txt')); |
|
784 | + $this->CakeEmail->addAttachments(CAKE.'bootstrap.php'); |
|
785 | + $this->CakeEmail->addAttachments(array(CAKE.'bootstrap.php')); |
|
786 | + $this->CakeEmail->addAttachments(array('other.txt' => CAKE.'bootstrap.php', 'license' => CAKE.'LICENSE.txt')); |
|
787 | 787 | $expected = array( |
788 | - 'basics.php' => array('file' => CAKE . 'basics.php', 'mimetype' => 'text/plain'), |
|
789 | - 'bootstrap.php' => array('file' => CAKE . 'bootstrap.php', 'mimetype' => 'application/octet-stream'), |
|
790 | - 'other.txt' => array('file' => CAKE . 'bootstrap.php', 'mimetype' => 'application/octet-stream'), |
|
791 | - 'license' => array('file' => CAKE . 'LICENSE.txt', 'mimetype' => 'application/octet-stream') |
|
788 | + 'basics.php' => array('file' => CAKE.'basics.php', 'mimetype' => 'text/plain'), |
|
789 | + 'bootstrap.php' => array('file' => CAKE.'bootstrap.php', 'mimetype' => 'application/octet-stream'), |
|
790 | + 'other.txt' => array('file' => CAKE.'bootstrap.php', 'mimetype' => 'application/octet-stream'), |
|
791 | + 'license' => array('file' => CAKE.'LICENSE.txt', 'mimetype' => 'application/octet-stream') |
|
792 | 792 | ); |
793 | 793 | $this->assertSame($this->CakeEmail->attachments(), $expected); |
794 | 794 | |
795 | 795 | $this->setExpectedException('SocketException'); |
796 | - $this->CakeEmail->attachments(array(array('nofile' => CAKE . 'basics.php', 'mimetype' => 'text/plain'))); |
|
796 | + $this->CakeEmail->attachments(array(array('nofile' => CAKE.'basics.php', 'mimetype' => 'text/plain'))); |
|
797 | 797 | } |
798 | 798 | |
799 | 799 | /** |
@@ -948,15 +948,15 @@ discard block |
||
948 | 948 | $expected = "Here is my body, with multi lines.\r\nThis is the second line.\r\n\r\nAnd the last.\r\n\r\n"; |
949 | 949 | |
950 | 950 | $this->assertEquals($expected, $result['message']); |
951 | - $this->assertTrue((bool)strpos($result['headers'], 'Date: ')); |
|
952 | - $this->assertTrue((bool)strpos($result['headers'], 'Message-ID: ')); |
|
953 | - $this->assertTrue((bool)strpos($result['headers'], 'To: ')); |
|
951 | + $this->assertTrue((bool) strpos($result['headers'], 'Date: ')); |
|
952 | + $this->assertTrue((bool) strpos($result['headers'], 'Message-ID: ')); |
|
953 | + $this->assertTrue((bool) strpos($result['headers'], 'To: ')); |
|
954 | 954 | |
955 | 955 | $result = $this->CakeEmail->send("Other body"); |
956 | 956 | $expected = "Other body\r\n\r\n"; |
957 | 957 | $this->assertSame($result['message'], $expected); |
958 | - $this->assertTrue((bool)strpos($result['headers'], 'Message-ID: ')); |
|
959 | - $this->assertTrue((bool)strpos($result['headers'], 'To: ')); |
|
958 | + $this->assertTrue((bool) strpos($result['headers'], 'Message-ID: ')); |
|
959 | + $this->assertTrue((bool) strpos($result['headers'], 'To: ')); |
|
960 | 960 | |
961 | 961 | $this->CakeEmail->reset(); |
962 | 962 | $this->CakeEmail->transport('Debug'); |
@@ -1008,22 +1008,22 @@ discard block |
||
1008 | 1008 | $this->CakeEmail->to('[email protected]'); |
1009 | 1009 | $this->CakeEmail->subject('My title'); |
1010 | 1010 | $this->CakeEmail->emailFormat('text'); |
1011 | - $this->CakeEmail->attachments(array(CAKE . 'basics.php')); |
|
1011 | + $this->CakeEmail->attachments(array(CAKE.'basics.php')); |
|
1012 | 1012 | $result = $this->CakeEmail->send('Hello'); |
1013 | 1013 | |
1014 | 1014 | $boundary = $this->CakeEmail->getBoundary(); |
1015 | - $this->assertContains('Content-Type: multipart/mixed; boundary="' . $boundary . '"', $result['headers']); |
|
1016 | - $expected = "--$boundary\r\n" . |
|
1017 | - "Content-Type: text/plain; charset=UTF-8\r\n" . |
|
1018 | - "Content-Transfer-Encoding: 8bit\r\n" . |
|
1019 | - "\r\n" . |
|
1020 | - "Hello" . |
|
1021 | - "\r\n" . |
|
1022 | - "\r\n" . |
|
1023 | - "\r\n" . |
|
1024 | - "--$boundary\r\n" . |
|
1025 | - "Content-Type: application/octet-stream\r\n" . |
|
1026 | - "Content-Transfer-Encoding: base64\r\n" . |
|
1015 | + $this->assertContains('Content-Type: multipart/mixed; boundary="'.$boundary.'"', $result['headers']); |
|
1016 | + $expected = "--$boundary\r\n". |
|
1017 | + "Content-Type: text/plain; charset=UTF-8\r\n". |
|
1018 | + "Content-Transfer-Encoding: 8bit\r\n". |
|
1019 | + "\r\n". |
|
1020 | + "Hello". |
|
1021 | + "\r\n". |
|
1022 | + "\r\n". |
|
1023 | + "\r\n". |
|
1024 | + "--$boundary\r\n". |
|
1025 | + "Content-Type: application/octet-stream\r\n". |
|
1026 | + "Content-Transfer-Encoding: base64\r\n". |
|
1027 | 1027 | "Content-Disposition: attachment; filename=\"basics.php\"\r\n\r\n"; |
1028 | 1028 | $this->assertContains($expected, $result['message']); |
1029 | 1029 | } |
@@ -1040,7 +1040,7 @@ discard block |
||
1040 | 1040 | $this->CakeEmail->to('[email protected]'); |
1041 | 1041 | $this->CakeEmail->subject('My title'); |
1042 | 1042 | $this->CakeEmail->emailFormat('text'); |
1043 | - $data = file_get_contents(CAKE . 'Console/Templates/skel/webroot/img/cake.icon.png'); |
|
1043 | + $data = file_get_contents(CAKE.'Console/Templates/skel/webroot/img/cake.icon.png'); |
|
1044 | 1044 | $this->CakeEmail->attachments(array('cake.icon.png' => array( |
1045 | 1045 | 'data' => $data, |
1046 | 1046 | 'mimetype' => 'image/png' |
@@ -1048,18 +1048,18 @@ discard block |
||
1048 | 1048 | $result = $this->CakeEmail->send('Hello'); |
1049 | 1049 | |
1050 | 1050 | $boundary = $this->CakeEmail->getBoundary(); |
1051 | - $this->assertContains('Content-Type: multipart/mixed; boundary="' . $boundary . '"', $result['headers']); |
|
1052 | - $expected = "--$boundary\r\n" . |
|
1053 | - "Content-Type: text/plain; charset=UTF-8\r\n" . |
|
1054 | - "Content-Transfer-Encoding: 8bit\r\n" . |
|
1055 | - "\r\n" . |
|
1056 | - "Hello" . |
|
1057 | - "\r\n" . |
|
1058 | - "\r\n" . |
|
1059 | - "\r\n" . |
|
1060 | - "--$boundary\r\n" . |
|
1061 | - "Content-Type: image/png\r\n" . |
|
1062 | - "Content-Transfer-Encoding: base64\r\n" . |
|
1051 | + $this->assertContains('Content-Type: multipart/mixed; boundary="'.$boundary.'"', $result['headers']); |
|
1052 | + $expected = "--$boundary\r\n". |
|
1053 | + "Content-Type: text/plain; charset=UTF-8\r\n". |
|
1054 | + "Content-Transfer-Encoding: 8bit\r\n". |
|
1055 | + "\r\n". |
|
1056 | + "Hello". |
|
1057 | + "\r\n". |
|
1058 | + "\r\n". |
|
1059 | + "\r\n". |
|
1060 | + "--$boundary\r\n". |
|
1061 | + "Content-Type: image/png\r\n". |
|
1062 | + "Content-Transfer-Encoding: base64\r\n". |
|
1063 | 1063 | "Content-Disposition: attachment; filename=\"cake.icon.png\"\r\n\r\n"; |
1064 | 1064 | $expected .= chunk_split(base64_encode($data), 76, "\r\n"); |
1065 | 1065 | $this->assertContains($expected, $result['message']); |
@@ -1076,35 +1076,35 @@ discard block |
||
1076 | 1076 | $this->CakeEmail->to('[email protected]'); |
1077 | 1077 | $this->CakeEmail->subject('My title'); |
1078 | 1078 | $this->CakeEmail->emailFormat('both'); |
1079 | - $this->CakeEmail->attachments(array(CAKE . 'VERSION.txt')); |
|
1079 | + $this->CakeEmail->attachments(array(CAKE.'VERSION.txt')); |
|
1080 | 1080 | $result = $this->CakeEmail->send('Hello'); |
1081 | 1081 | |
1082 | 1082 | $boundary = $this->CakeEmail->getBoundary(); |
1083 | - $this->assertContains('Content-Type: multipart/mixed; boundary="' . $boundary . '"', $result['headers']); |
|
1084 | - $expected = "--$boundary\r\n" . |
|
1085 | - "Content-Type: multipart/alternative; boundary=\"alt-$boundary\"\r\n" . |
|
1086 | - "\r\n" . |
|
1087 | - "--alt-$boundary\r\n" . |
|
1088 | - "Content-Type: text/plain; charset=UTF-8\r\n" . |
|
1089 | - "Content-Transfer-Encoding: 8bit\r\n" . |
|
1090 | - "\r\n" . |
|
1091 | - "Hello" . |
|
1092 | - "\r\n" . |
|
1093 | - "\r\n" . |
|
1094 | - "\r\n" . |
|
1095 | - "--alt-$boundary\r\n" . |
|
1096 | - "Content-Type: text/html; charset=UTF-8\r\n" . |
|
1097 | - "Content-Transfer-Encoding: 8bit\r\n" . |
|
1098 | - "\r\n" . |
|
1099 | - "Hello" . |
|
1100 | - "\r\n" . |
|
1101 | - "\r\n" . |
|
1102 | - "\r\n" . |
|
1103 | - "--alt-{$boundary}--\r\n" . |
|
1104 | - "\r\n" . |
|
1105 | - "--$boundary\r\n" . |
|
1106 | - "Content-Type: application/octet-stream\r\n" . |
|
1107 | - "Content-Transfer-Encoding: base64\r\n" . |
|
1083 | + $this->assertContains('Content-Type: multipart/mixed; boundary="'.$boundary.'"', $result['headers']); |
|
1084 | + $expected = "--$boundary\r\n". |
|
1085 | + "Content-Type: multipart/alternative; boundary=\"alt-$boundary\"\r\n". |
|
1086 | + "\r\n". |
|
1087 | + "--alt-$boundary\r\n". |
|
1088 | + "Content-Type: text/plain; charset=UTF-8\r\n". |
|
1089 | + "Content-Transfer-Encoding: 8bit\r\n". |
|
1090 | + "\r\n". |
|
1091 | + "Hello". |
|
1092 | + "\r\n". |
|
1093 | + "\r\n". |
|
1094 | + "\r\n". |
|
1095 | + "--alt-$boundary\r\n". |
|
1096 | + "Content-Type: text/html; charset=UTF-8\r\n". |
|
1097 | + "Content-Transfer-Encoding: 8bit\r\n". |
|
1098 | + "\r\n". |
|
1099 | + "Hello". |
|
1100 | + "\r\n". |
|
1101 | + "\r\n". |
|
1102 | + "\r\n". |
|
1103 | + "--alt-{$boundary}--\r\n". |
|
1104 | + "\r\n". |
|
1105 | + "--$boundary\r\n". |
|
1106 | + "Content-Type: application/octet-stream\r\n". |
|
1107 | + "Content-Transfer-Encoding: base64\r\n". |
|
1108 | 1108 | "Content-Disposition: attachment; filename=\"VERSION.txt\"\r\n\r\n"; |
1109 | 1109 | $this->assertContains($expected, $result['message']); |
1110 | 1110 | } |
@@ -1122,46 +1122,46 @@ discard block |
||
1122 | 1122 | $this->CakeEmail->emailFormat('both'); |
1123 | 1123 | $this->CakeEmail->attachments(array( |
1124 | 1124 | 'cake.png' => array( |
1125 | - 'file' => CAKE . 'VERSION.txt', |
|
1125 | + 'file' => CAKE.'VERSION.txt', |
|
1126 | 1126 | 'contentId' => 'abc123' |
1127 | 1127 | ) |
1128 | 1128 | )); |
1129 | 1129 | $result = $this->CakeEmail->send('Hello'); |
1130 | 1130 | |
1131 | 1131 | $boundary = $this->CakeEmail->getBoundary(); |
1132 | - $this->assertContains('Content-Type: multipart/mixed; boundary="' . $boundary . '"', $result['headers']); |
|
1133 | - $expected = "--$boundary\r\n" . |
|
1134 | - "Content-Type: multipart/related; boundary=\"rel-$boundary\"\r\n" . |
|
1135 | - "\r\n" . |
|
1136 | - "--rel-$boundary\r\n" . |
|
1137 | - "Content-Type: multipart/alternative; boundary=\"alt-$boundary\"\r\n" . |
|
1138 | - "\r\n" . |
|
1139 | - "--alt-$boundary\r\n" . |
|
1140 | - "Content-Type: text/plain; charset=UTF-8\r\n" . |
|
1141 | - "Content-Transfer-Encoding: 8bit\r\n" . |
|
1142 | - "\r\n" . |
|
1143 | - "Hello" . |
|
1144 | - "\r\n" . |
|
1145 | - "\r\n" . |
|
1146 | - "\r\n" . |
|
1147 | - "--alt-$boundary\r\n" . |
|
1148 | - "Content-Type: text/html; charset=UTF-8\r\n" . |
|
1149 | - "Content-Transfer-Encoding: 8bit\r\n" . |
|
1150 | - "\r\n" . |
|
1151 | - "Hello" . |
|
1152 | - "\r\n" . |
|
1153 | - "\r\n" . |
|
1154 | - "\r\n" . |
|
1155 | - "--alt-{$boundary}--\r\n" . |
|
1156 | - "\r\n" . |
|
1157 | - "--rel-$boundary\r\n" . |
|
1158 | - "Content-Type: application/octet-stream\r\n" . |
|
1159 | - "Content-Transfer-Encoding: base64\r\n" . |
|
1160 | - "Content-ID: <abc123>\r\n" . |
|
1132 | + $this->assertContains('Content-Type: multipart/mixed; boundary="'.$boundary.'"', $result['headers']); |
|
1133 | + $expected = "--$boundary\r\n". |
|
1134 | + "Content-Type: multipart/related; boundary=\"rel-$boundary\"\r\n". |
|
1135 | + "\r\n". |
|
1136 | + "--rel-$boundary\r\n". |
|
1137 | + "Content-Type: multipart/alternative; boundary=\"alt-$boundary\"\r\n". |
|
1138 | + "\r\n". |
|
1139 | + "--alt-$boundary\r\n". |
|
1140 | + "Content-Type: text/plain; charset=UTF-8\r\n". |
|
1141 | + "Content-Transfer-Encoding: 8bit\r\n". |
|
1142 | + "\r\n". |
|
1143 | + "Hello". |
|
1144 | + "\r\n". |
|
1145 | + "\r\n". |
|
1146 | + "\r\n". |
|
1147 | + "--alt-$boundary\r\n". |
|
1148 | + "Content-Type: text/html; charset=UTF-8\r\n". |
|
1149 | + "Content-Transfer-Encoding: 8bit\r\n". |
|
1150 | + "\r\n". |
|
1151 | + "Hello". |
|
1152 | + "\r\n". |
|
1153 | + "\r\n". |
|
1154 | + "\r\n". |
|
1155 | + "--alt-{$boundary}--\r\n". |
|
1156 | + "\r\n". |
|
1157 | + "--rel-$boundary\r\n". |
|
1158 | + "Content-Type: application/octet-stream\r\n". |
|
1159 | + "Content-Transfer-Encoding: base64\r\n". |
|
1160 | + "Content-ID: <abc123>\r\n". |
|
1161 | 1161 | "Content-Disposition: inline; filename=\"cake.png\"\r\n\r\n"; |
1162 | 1162 | $this->assertContains($expected, $result['message']); |
1163 | - $this->assertContains('--rel-' . $boundary . '--', $result['message']); |
|
1164 | - $this->assertContains('--' . $boundary . '--', $result['message']); |
|
1163 | + $this->assertContains('--rel-'.$boundary.'--', $result['message']); |
|
1164 | + $this->assertContains('--'.$boundary.'--', $result['message']); |
|
1165 | 1165 | } |
1166 | 1166 | |
1167 | 1167 | /** |
@@ -1177,29 +1177,29 @@ discard block |
||
1177 | 1177 | $this->CakeEmail->emailFormat('text'); |
1178 | 1178 | $this->CakeEmail->attachments(array( |
1179 | 1179 | 'cake.png' => array( |
1180 | - 'file' => CAKE . 'VERSION.txt', |
|
1180 | + 'file' => CAKE.'VERSION.txt', |
|
1181 | 1181 | 'contentDisposition' => false |
1182 | 1182 | ) |
1183 | 1183 | )); |
1184 | 1184 | $result = $this->CakeEmail->send('Hello'); |
1185 | 1185 | |
1186 | 1186 | $boundary = $this->CakeEmail->getBoundary(); |
1187 | - $this->assertContains('Content-Type: multipart/mixed; boundary="' . $boundary . '"', $result['headers']); |
|
1188 | - $expected = "--$boundary\r\n" . |
|
1189 | - "Content-Type: text/plain; charset=UTF-8\r\n" . |
|
1190 | - "Content-Transfer-Encoding: 8bit\r\n" . |
|
1191 | - "\r\n" . |
|
1192 | - "Hello" . |
|
1193 | - "\r\n" . |
|
1194 | - "\r\n" . |
|
1195 | - "\r\n" . |
|
1196 | - "--{$boundary}\r\n" . |
|
1197 | - "Content-Type: application/octet-stream\r\n" . |
|
1198 | - "Content-Transfer-Encoding: base64\r\n" . |
|
1187 | + $this->assertContains('Content-Type: multipart/mixed; boundary="'.$boundary.'"', $result['headers']); |
|
1188 | + $expected = "--$boundary\r\n". |
|
1189 | + "Content-Type: text/plain; charset=UTF-8\r\n". |
|
1190 | + "Content-Transfer-Encoding: 8bit\r\n". |
|
1191 | + "\r\n". |
|
1192 | + "Hello". |
|
1193 | + "\r\n". |
|
1194 | + "\r\n". |
|
1195 | + "\r\n". |
|
1196 | + "--{$boundary}\r\n". |
|
1197 | + "Content-Type: application/octet-stream\r\n". |
|
1198 | + "Content-Transfer-Encoding: base64\r\n". |
|
1199 | 1199 | "\r\n"; |
1200 | 1200 | |
1201 | 1201 | $this->assertContains($expected, $result['message']); |
1202 | - $this->assertContains('--' . $boundary . '--', $result['message']); |
|
1202 | + $this->assertContains('--'.$boundary.'--', $result['message']); |
|
1203 | 1203 | } |
1204 | 1204 | /** |
1205 | 1205 | * testSendWithLog method |
@@ -1220,7 +1220,7 @@ discard block |
||
1220 | 1220 | $result = $this->CakeEmail->send("Logging This"); |
1221 | 1221 | |
1222 | 1222 | App::uses('File', 'Utility'); |
1223 | - $File = new File(TMP . 'cake_test_emails.log'); |
|
1223 | + $File = new File(TMP.'cake_test_emails.log'); |
|
1224 | 1224 | $log = $File->read(); |
1225 | 1225 | $this->assertTrue(strpos($log, $result['headers']) !== false); |
1226 | 1226 | $this->assertTrue(strpos($log, $result['message']) !== false); |
@@ -1249,7 +1249,7 @@ discard block |
||
1249 | 1249 | $result = $this->CakeEmail->send("Logging This"); |
1250 | 1250 | |
1251 | 1251 | App::uses('File', 'Utility'); |
1252 | - $File = new File(TMP . 'cake_test_emails.log'); |
|
1252 | + $File = new File(TMP.'cake_test_emails.log'); |
|
1253 | 1253 | $log = $File->read(); |
1254 | 1254 | $this->assertTrue(strpos($log, $result['headers']) !== false); |
1255 | 1255 | $this->assertTrue(strpos($log, $result['message']) !== false); |
@@ -1304,7 +1304,7 @@ discard block |
||
1304 | 1304 | * @return void |
1305 | 1305 | */ |
1306 | 1306 | public function testSendRenderJapanese() { |
1307 | - $this->skipIf(!function_exists('mb_convert_encoding')); |
|
1307 | + $this->skipIf( ! function_exists('mb_convert_encoding')); |
|
1308 | 1308 | |
1309 | 1309 | $this->CakeEmail->reset(); |
1310 | 1310 | $this->CakeEmail->transport('debug'); |
@@ -1393,7 +1393,7 @@ discard block |
||
1393 | 1393 | * @return void |
1394 | 1394 | */ |
1395 | 1395 | public function testSendRenderWithVarsJapanese() { |
1396 | - $this->skipIf(!function_exists('mb_convert_encoding')); |
|
1396 | + $this->skipIf( ! function_exists('mb_convert_encoding')); |
|
1397 | 1397 | $this->CakeEmail->reset(); |
1398 | 1398 | $this->CakeEmail->transport('debug'); |
1399 | 1399 | |
@@ -1407,7 +1407,7 @@ discard block |
||
1407 | 1407 | $result = $this->CakeEmail->send(); |
1408 | 1408 | |
1409 | 1409 | $expected = mb_convert_encoding('ここにあなたの設定した値が入ります: 日本語の差し込み123', 'ISO-2022-JP'); |
1410 | - $this->assertTrue((bool)strpos($result['message'], $expected)); |
|
1410 | + $this->assertTrue((bool) strpos($result['message'], $expected)); |
|
1411 | 1411 | } |
1412 | 1412 | |
1413 | 1413 | /** |
@@ -1431,7 +1431,7 @@ discard block |
||
1431 | 1431 | $this->assertInstanceOf('CakeEmail', $result); |
1432 | 1432 | |
1433 | 1433 | $result = $this->CakeEmail->send(); |
1434 | - $this->assertTrue((bool)strpos($result['message'], 'Right now: ' . date('Y-m-d\TH:i:s\Z', $timestamp))); |
|
1434 | + $this->assertTrue((bool) strpos($result['message'], 'Right now: '.date('Y-m-d\TH:i:s\Z', $timestamp))); |
|
1435 | 1435 | |
1436 | 1436 | $result = $this->CakeEmail->helpers(); |
1437 | 1437 | $this->assertEquals(array('Time'), $result); |
@@ -1455,10 +1455,10 @@ discard block |
||
1455 | 1455 | $server = env('SERVER_NAME') ? env('SERVER_NAME') : 'localhost'; |
1456 | 1456 | |
1457 | 1457 | if (env('SERVER_PORT') && env('SERVER_PORT') != 80) { |
1458 | - $server .= ':' . env('SERVER_PORT'); |
|
1458 | + $server .= ':'.env('SERVER_PORT'); |
|
1459 | 1459 | } |
1460 | 1460 | |
1461 | - $expected = '<img src="http://' . $server . '/img/image.gif" alt="cool image" width="100" height="100" />'; |
|
1461 | + $expected = '<img src="http://'.$server.'/img/image.gif" alt="cool image" width="100" height="100" />'; |
|
1462 | 1462 | $result = $this->CakeEmail->send(); |
1463 | 1463 | $this->assertContains($expected, $result['message']); |
1464 | 1464 | } |
@@ -1470,7 +1470,7 @@ discard block |
||
1470 | 1470 | */ |
1471 | 1471 | public function testSendRenderPlugin() { |
1472 | 1472 | App::build(array( |
1473 | - 'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS) |
|
1473 | + 'Plugin' => array(CAKE.'Test'.DS.'test_app'.DS.'Plugin'.DS) |
|
1474 | 1474 | )); |
1475 | 1475 | CakePlugin::load(array('TestPlugin', 'TestPluginTwo')); |
1476 | 1476 | |
@@ -1537,10 +1537,10 @@ discard block |
||
1537 | 1537 | $message = $this->CakeEmail->message(); |
1538 | 1538 | $boundary = $this->CakeEmail->getBoundary(); |
1539 | 1539 | $this->assertFalse(empty($boundary)); |
1540 | - $this->assertContains('--' . $boundary, $message); |
|
1541 | - $this->assertContains('--' . $boundary . '--', $message); |
|
1542 | - $this->assertContains('--alt-' . $boundary, $message); |
|
1543 | - $this->assertContains('--alt-' . $boundary . '--', $message); |
|
1540 | + $this->assertContains('--'.$boundary, $message); |
|
1541 | + $this->assertContains('--'.$boundary.'--', $message); |
|
1542 | + $this->assertContains('--alt-'.$boundary, $message); |
|
1543 | + $this->assertContains('--alt-'.$boundary.'--', $message); |
|
1544 | 1544 | |
1545 | 1545 | $this->CakeEmail->attachments(array('fake.php' => __FILE__)); |
1546 | 1546 | $this->CakeEmail->send(); |
@@ -1548,10 +1548,10 @@ discard block |
||
1548 | 1548 | $message = $this->CakeEmail->message(); |
1549 | 1549 | $boundary = $this->CakeEmail->getBoundary(); |
1550 | 1550 | $this->assertFalse(empty($boundary)); |
1551 | - $this->assertContains('--' . $boundary, $message); |
|
1552 | - $this->assertContains('--' . $boundary . '--', $message); |
|
1553 | - $this->assertContains('--alt-' . $boundary, $message); |
|
1554 | - $this->assertContains('--alt-' . $boundary . '--', $message); |
|
1551 | + $this->assertContains('--'.$boundary, $message); |
|
1552 | + $this->assertContains('--'.$boundary.'--', $message); |
|
1553 | + $this->assertContains('--alt-'.$boundary, $message); |
|
1554 | + $this->assertContains('--alt-'.$boundary.'--', $message); |
|
1555 | 1555 | } |
1556 | 1556 | |
1557 | 1557 | /** |
@@ -1566,19 +1566,19 @@ discard block |
||
1566 | 1566 | $this->CakeEmail->to(array('[email protected]' => 'You')); |
1567 | 1567 | $this->CakeEmail->subject('My title'); |
1568 | 1568 | $this->CakeEmail->config(array()); |
1569 | - $this->CakeEmail->attachments(array(CAKE . 'basics.php')); |
|
1569 | + $this->CakeEmail->attachments(array(CAKE.'basics.php')); |
|
1570 | 1570 | $result = $this->CakeEmail->send('body'); |
1571 | 1571 | $this->assertContains("Content-Type: application/octet-stream\r\nContent-Transfer-Encoding: base64\r\nContent-Disposition: attachment; filename=\"basics.php\"", $result['message']); |
1572 | 1572 | |
1573 | - $this->CakeEmail->attachments(array('my.file.txt' => CAKE . 'basics.php')); |
|
1573 | + $this->CakeEmail->attachments(array('my.file.txt' => CAKE.'basics.php')); |
|
1574 | 1574 | $result = $this->CakeEmail->send('body'); |
1575 | 1575 | $this->assertContains("Content-Type: application/octet-stream\r\nContent-Transfer-Encoding: base64\r\nContent-Disposition: attachment; filename=\"my.file.txt\"", $result['message']); |
1576 | 1576 | |
1577 | - $this->CakeEmail->attachments(array('file.txt' => array('file' => CAKE . 'basics.php', 'mimetype' => 'text/plain'))); |
|
1577 | + $this->CakeEmail->attachments(array('file.txt' => array('file' => CAKE.'basics.php', 'mimetype' => 'text/plain'))); |
|
1578 | 1578 | $result = $this->CakeEmail->send('body'); |
1579 | 1579 | $this->assertContains("Content-Type: text/plain\r\nContent-Transfer-Encoding: base64\r\nContent-Disposition: attachment; filename=\"file.txt\"", $result['message']); |
1580 | 1580 | |
1581 | - $this->CakeEmail->attachments(array('file2.txt' => array('file' => CAKE . 'basics.php', 'mimetype' => 'text/plain', 'contentId' => 'a1b1c1'))); |
|
1581 | + $this->CakeEmail->attachments(array('file2.txt' => array('file' => CAKE.'basics.php', 'mimetype' => 'text/plain', 'contentId' => 'a1b1c1'))); |
|
1582 | 1582 | $result = $this->CakeEmail->send('body'); |
1583 | 1583 | $this->assertContains("Content-Type: text/plain\r\nContent-Transfer-Encoding: base64\r\nContent-ID: <a1b1c1>\r\nContent-Disposition: inline; filename=\"file2.txt\"", $result['message']); |
1584 | 1584 | } |
@@ -1761,7 +1761,7 @@ discard block |
||
1761 | 1761 | public function testRenderWithLayoutAndAttachment() { |
1762 | 1762 | $this->CakeEmail->emailFormat('html'); |
1763 | 1763 | $this->CakeEmail->template('html', 'default'); |
1764 | - $this->CakeEmail->attachments(array(CAKE . 'basics.php')); |
|
1764 | + $this->CakeEmail->attachments(array(CAKE.'basics.php')); |
|
1765 | 1765 | $result = $this->CakeEmail->render(array()); |
1766 | 1766 | $this->assertNotEmpty($result); |
1767 | 1767 | |
@@ -1800,8 +1800,8 @@ discard block |
||
1800 | 1800 | |
1801 | 1801 | $result = $this->CakeEmail->send('This is the message'); |
1802 | 1802 | |
1803 | - $this->assertTrue((bool)strpos($result['headers'], 'Message-ID: ')); |
|
1804 | - $this->assertTrue((bool)strpos($result['headers'], 'To: ')); |
|
1803 | + $this->assertTrue((bool) strpos($result['headers'], 'Message-ID: ')); |
|
1804 | + $this->assertTrue((bool) strpos($result['headers'], 'To: ')); |
|
1805 | 1805 | } |
1806 | 1806 | |
1807 | 1807 | /** |
@@ -1830,8 +1830,8 @@ discard block |
||
1830 | 1830 | |
1831 | 1831 | $result = $this->CakeEmail->send('This is the message'); |
1832 | 1832 | |
1833 | - $this->assertTrue((bool)strpos($result['headers'], 'Message-ID: ')); |
|
1834 | - $this->assertTrue((bool)strpos($result['headers'], 'To: ')); |
|
1833 | + $this->assertTrue((bool) strpos($result['headers'], 'Message-ID: ')); |
|
1834 | + $this->assertTrue((bool) strpos($result['headers'], 'To: ')); |
|
1835 | 1835 | } |
1836 | 1836 | |
1837 | 1837 | /** |
@@ -1898,7 +1898,7 @@ discard block |
||
1898 | 1898 | * @return void |
1899 | 1899 | */ |
1900 | 1900 | public function testHeaderEncoding() { |
1901 | - $this->skipIf(!function_exists('mb_convert_encoding')); |
|
1901 | + $this->skipIf( ! function_exists('mb_convert_encoding')); |
|
1902 | 1902 | $email = new CakeEmail(array('headerCharset' => 'iso-2022-jp-ms', 'transport' => 'Debug')); |
1903 | 1903 | $email->subject('あれ?もしかしての前と'); |
1904 | 1904 | $headers = $email->getHeaders(array('subject')); |
@@ -1916,7 +1916,7 @@ discard block |
||
1916 | 1916 | * @return void |
1917 | 1917 | */ |
1918 | 1918 | public function testBodyEncoding() { |
1919 | - $this->skipIf(!function_exists('mb_convert_encoding')); |
|
1919 | + $this->skipIf( ! function_exists('mb_convert_encoding')); |
|
1920 | 1920 | $email = new CakeEmail(array( |
1921 | 1921 | 'charset' => 'iso-2022-jp', |
1922 | 1922 | 'headerCharset' => 'iso-2022-jp-ms', |
@@ -1939,7 +1939,7 @@ discard block |
||
1939 | 1939 | * @return void |
1940 | 1940 | */ |
1941 | 1941 | public function testBodyEncodingIso2022Jp() { |
1942 | - $this->skipIf(!function_exists('mb_convert_encoding')); |
|
1942 | + $this->skipIf( ! function_exists('mb_convert_encoding')); |
|
1943 | 1943 | $email = new CakeEmail(array( |
1944 | 1944 | 'charset' => 'iso-2022-jp', |
1945 | 1945 | 'headerCharset' => 'iso-2022-jp', |
@@ -1963,7 +1963,7 @@ discard block |
||
1963 | 1963 | * @return void |
1964 | 1964 | */ |
1965 | 1965 | public function testBodyEncodingIso2022JpMs() { |
1966 | - $this->skipIf(!function_exists('mb_convert_encoding')); |
|
1966 | + $this->skipIf( ! function_exists('mb_convert_encoding')); |
|
1967 | 1967 | $email = new CakeEmail(array( |
1968 | 1968 | 'charset' => 'iso-2022-jp-ms', |
1969 | 1969 | 'headerCharset' => 'iso-2022-jp-ms', |
@@ -1982,7 +1982,7 @@ discard block |
||
1982 | 1982 | } |
1983 | 1983 | |
1984 | 1984 | protected function _checkContentTransferEncoding($message, $charset) { |
1985 | - $boundary = '--alt-' . $this->CakeEmail->getBoundary(); |
|
1985 | + $boundary = '--alt-'.$this->CakeEmail->getBoundary(); |
|
1986 | 1986 | $result['text'] = false; |
1987 | 1987 | $result['html'] = false; |
1988 | 1988 | $length = count($message); |
@@ -1990,14 +1990,14 @@ discard block |
||
1990 | 1990 | if ($message[$i] == $boundary) { |
1991 | 1991 | $flag = false; |
1992 | 1992 | $type = ''; |
1993 | - while (!preg_match('/^$/', $message[$i])) { |
|
1993 | + while ( ! preg_match('/^$/', $message[$i])) { |
|
1994 | 1994 | if (preg_match('/^Content-Type: text\/plain/', $message[$i])) { |
1995 | 1995 | $type = 'text'; |
1996 | 1996 | } |
1997 | 1997 | if (preg_match('/^Content-Type: text\/html/', $message[$i])) { |
1998 | 1998 | $type = 'html'; |
1999 | 1999 | } |
2000 | - if ($message[$i] === 'Content-Transfer-Encoding: ' . $charset) { |
|
2000 | + if ($message[$i] === 'Content-Transfer-Encoding: '.$charset) { |
|
2001 | 2001 | $flag = true; |
2002 | 2002 | } |
2003 | 2003 | ++$i; |
@@ -2014,7 +2014,7 @@ discard block |
||
2014 | 2014 | * @return void |
2015 | 2015 | */ |
2016 | 2016 | public function testEncode() { |
2017 | - $this->skipIf(!function_exists('mb_convert_encoding')); |
|
2017 | + $this->skipIf( ! function_exists('mb_convert_encoding')); |
|
2018 | 2018 | |
2019 | 2019 | $this->CakeEmail->headerCharset = 'ISO-2022-JP'; |
2020 | 2020 | $result = $this->CakeEmail->encode('日本語'); |
@@ -2023,8 +2023,8 @@ discard block |
||
2023 | 2023 | |
2024 | 2024 | $this->CakeEmail->headerCharset = 'ISO-2022-JP'; |
2025 | 2025 | $result = $this->CakeEmail->encode('長い長い長いSubjectの場合はfoldingするのが正しいんだけどいったいどうなるんだろう?'); |
2026 | - $expected = "=?ISO-2022-JP?B?GyRCRDkkJEQ5JCREOSQkGyhCU3ViamVjdBskQiROPmw5ZyRPGyhCZm9s?=\r\n" . |
|
2027 | - " =?ISO-2022-JP?B?ZGluZxskQiQ5JGskTiQsQDUkNyQkJHMkQCQxJEkkJCRDJD8kJCRJGyhC?=\r\n" . |
|
2026 | + $expected = "=?ISO-2022-JP?B?GyRCRDkkJEQ5JCREOSQkGyhCU3ViamVjdBskQiROPmw5ZyRPGyhCZm9s?=\r\n". |
|
2027 | + " =?ISO-2022-JP?B?ZGluZxskQiQ5JGskTiQsQDUkNyQkJHMkQCQxJEkkJCRDJD8kJCRJGyhC?=\r\n". |
|
2028 | 2028 | " =?ISO-2022-JP?B?GyRCJCYkSiRrJHMkQCRtJCYhKRsoQg==?="; |
2029 | 2029 | $this->assertSame($expected, $result); |
2030 | 2030 | } |
@@ -2069,7 +2069,7 @@ discard block |
||
2069 | 2069 | * @return void |
2070 | 2070 | */ |
2071 | 2071 | public function testCharsetsCompatible() { |
2072 | - $this->skipIf(!function_exists('mb_convert_encoding')); |
|
2072 | + $this->skipIf( ! function_exists('mb_convert_encoding')); |
|
2073 | 2073 | |
2074 | 2074 | $checkHeaders = array( |
2075 | 2075 | 'from' => true, |
@@ -2126,10 +2126,10 @@ discard block |
||
2126 | 2126 | protected function _getEmailByOldStyleCharset($charset, $headerCharset) { |
2127 | 2127 | $email = new CakeEmail(array('transport' => 'Debug')); |
2128 | 2128 | |
2129 | - if (! empty($charset)) { |
|
2129 | + if ( ! empty($charset)) { |
|
2130 | 2130 | $email->charset = $charset; |
2131 | 2131 | } |
2132 | - if (! empty($headerCharset)) { |
|
2132 | + if ( ! empty($headerCharset)) { |
|
2133 | 2133 | $email->headerCharset = $headerCharset; |
2134 | 2134 | } |
2135 | 2135 | |
@@ -2150,10 +2150,10 @@ discard block |
||
2150 | 2150 | protected function _getEmailByNewStyleCharset($charset, $headerCharset) { |
2151 | 2151 | $email = new CakeEmail(array('transport' => 'Debug')); |
2152 | 2152 | |
2153 | - if (! empty($charset)) { |
|
2153 | + if ( ! empty($charset)) { |
|
2154 | 2154 | $email->charset($charset); |
2155 | 2155 | } |
2156 | - if (! empty($headerCharset)) { |
|
2156 | + if ( ! empty($headerCharset)) { |
|
2157 | 2157 | $email->headerCharset($headerCharset); |
2158 | 2158 | } |
2159 | 2159 | |
@@ -2172,7 +2172,7 @@ discard block |
||
2172 | 2172 | * @return void |
2173 | 2173 | */ |
2174 | 2174 | public function testWrapLongLine() { |
2175 | - $message = '<a href="http://cakephp.org">' . str_repeat('x', CakeEmail::LINE_LENGTH_MUST) . "</a>"; |
|
2175 | + $message = '<a href="http://cakephp.org">'.str_repeat('x', CakeEmail::LINE_LENGTH_MUST)."</a>"; |
|
2176 | 2176 | |
2177 | 2177 | $this->CakeEmail->reset(); |
2178 | 2178 | $this->CakeEmail->transport('Debug'); |
@@ -2181,32 +2181,32 @@ discard block |
||
2181 | 2181 | $this->CakeEmail->subject('Wordwrap Test'); |
2182 | 2182 | $this->CakeEmail->config(array('empty')); |
2183 | 2183 | $result = $this->CakeEmail->send($message); |
2184 | - $expected = "<a\r\n" . 'href="http://cakephp.org">' . str_repeat('x', CakeEmail::LINE_LENGTH_MUST - 26) . "\r\n" . |
|
2185 | - str_repeat('x', 26) . "\r\n</a>\r\n\r\n"; |
|
2184 | + $expected = "<a\r\n".'href="http://cakephp.org">'.str_repeat('x', CakeEmail::LINE_LENGTH_MUST - 26)."\r\n". |
|
2185 | + str_repeat('x', 26)."\r\n</a>\r\n\r\n"; |
|
2186 | 2186 | $this->assertEquals($expected, $result['message']); |
2187 | 2187 | $this->assertLineLengths($result['message']); |
2188 | 2188 | |
2189 | 2189 | $str1 = "a "; |
2190 | 2190 | $str2 = " b"; |
2191 | 2191 | $length = strlen($str1) + strlen($str2); |
2192 | - $message = $str1 . str_repeat('x', CakeEmail::LINE_LENGTH_MUST - $length - 1) . $str2; |
|
2192 | + $message = $str1.str_repeat('x', CakeEmail::LINE_LENGTH_MUST - $length - 1).$str2; |
|
2193 | 2193 | |
2194 | 2194 | $result = $this->CakeEmail->send($message); |
2195 | 2195 | $expected = "{$message}\r\n\r\n"; |
2196 | 2196 | $this->assertEquals($expected, $result['message']); |
2197 | 2197 | $this->assertLineLengths($result['message']); |
2198 | 2198 | |
2199 | - $message = $str1 . str_repeat('x', CakeEmail::LINE_LENGTH_MUST - $length) . $str2; |
|
2199 | + $message = $str1.str_repeat('x', CakeEmail::LINE_LENGTH_MUST - $length).$str2; |
|
2200 | 2200 | |
2201 | 2201 | $result = $this->CakeEmail->send($message); |
2202 | 2202 | $expected = "{$message}\r\n\r\n"; |
2203 | 2203 | $this->assertEquals($expected, $result['message']); |
2204 | 2204 | $this->assertLineLengths($result['message']); |
2205 | 2205 | |
2206 | - $message = $str1 . str_repeat('x', CakeEmail::LINE_LENGTH_MUST - $length + 1) . $str2; |
|
2206 | + $message = $str1.str_repeat('x', CakeEmail::LINE_LENGTH_MUST - $length + 1).$str2; |
|
2207 | 2207 | |
2208 | 2208 | $result = $this->CakeEmail->send($message); |
2209 | - $expected = $str1 . str_repeat('x', CakeEmail::LINE_LENGTH_MUST - $length + 1) . sprintf("\r\n%s\r\n\r\n", trim($str2)); |
|
2209 | + $expected = $str1.str_repeat('x', CakeEmail::LINE_LENGTH_MUST - $length + 1).sprintf("\r\n%s\r\n\r\n", trim($str2)); |
|
2210 | 2210 | $this->assertEquals($expected, $result['message']); |
2211 | 2211 | $this->assertLineLengths($result['message']); |
2212 | 2212 | } |
@@ -2224,7 +2224,7 @@ discard block |
||
2224 | 2224 | </table> |
2225 | 2225 | HTML; |
2226 | 2226 | $length = strlen($str); |
2227 | - $message = $str . str_repeat('x', CakeEmail::LINE_LENGTH_MUST + 1); |
|
2227 | + $message = $str.str_repeat('x', CakeEmail::LINE_LENGTH_MUST + 1); |
|
2228 | 2228 | |
2229 | 2229 | $this->CakeEmail->reset(); |
2230 | 2230 | $this->CakeEmail->transport('Debug'); |
@@ -2248,7 +2248,7 @@ discard block |
||
2248 | 2248 | public function testWrapIncludeLessThanSign() { |
2249 | 2249 | $str = 'foo<bar'; |
2250 | 2250 | $length = strlen($str); |
2251 | - $message = $str . str_repeat('x', CakeEmail::LINE_LENGTH_MUST - $length + 1); |
|
2251 | + $message = $str.str_repeat('x', CakeEmail::LINE_LENGTH_MUST - $length + 1); |
|
2252 | 2252 | |
2253 | 2253 | $this->CakeEmail->reset(); |
2254 | 2254 | $this->CakeEmail->transport('Debug'); |
@@ -2269,7 +2269,7 @@ discard block |
||
2269 | 2269 | * @return void |
2270 | 2270 | */ |
2271 | 2271 | public function testWrapForJapaneseEncoding() { |
2272 | - $this->skipIf(!function_exists('mb_convert_encoding')); |
|
2272 | + $this->skipIf( ! function_exists('mb_convert_encoding')); |
|
2273 | 2273 | |
2274 | 2274 | $message = mb_convert_encoding('受け付けました', 'iso-2022-jp', 'UTF-8'); |
2275 | 2275 |
@@ -29,7 +29,7 @@ |
||
29 | 29 | /** |
30 | 30 | * Helper to change the socket |
31 | 31 | * |
32 | - * @param object $socket |
|
32 | + * @param CakeSocket $socket |
|
33 | 33 | * @return void |
34 | 34 | */ |
35 | 35 | public function setSocket(CakeSocket $socket) { |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * @return mixed |
63 | 63 | */ |
64 | 64 | public function __call($method, $args) { |
65 | - $method = '_' . $method; |
|
65 | + $method = '_'.$method; |
|
66 | 66 | return $this->$method(); |
67 | 67 | } |
68 | 68 | |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | $data .= "To: CakePHP <[email protected]>\r\n"; |
312 | 312 | $data .= "Cc: Mark Story <[email protected]>, Juan Basso <[email protected]>\r\n"; |
313 | 313 | $data .= "X-Mailer: CakePHP Email\r\n"; |
314 | - $data .= "Date: " . $date . "\r\n"; |
|
314 | + $data .= "Date: ".$date."\r\n"; |
|
315 | 315 | $data .= "Message-ID: <4d9946cf-0a44-4907-88fe-1d0ccbdd56cb@localhost>\r\n"; |
316 | 316 | $data .= "Subject: Testing SMTP\r\n"; |
317 | 317 | $data .= "MIME-Version: 1.0\r\n"; |
@@ -83,7 +83,7 @@ |
||
83 | 83 | * Convenience method for testing protected method |
84 | 84 | * |
85 | 85 | * @param string|array $uri URI (see {@link _parseUri()}) |
86 | - * @return array Current configuration settings |
|
86 | + * @return boolean Current configuration settings |
|
87 | 87 | */ |
88 | 88 | public function configUri($uri = null) { |
89 | 89 | return parent::_configUri($uri); |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * @return void |
35 | 35 | */ |
36 | 36 | public static function authentication(HttpSocket $http, &$authInfo) { |
37 | - $http->request['header']['Authorization'] = 'Test ' . $authInfo['user'] . '.' . $authInfo['pass']; |
|
37 | + $http->request['header']['Authorization'] = 'Test '.$authInfo['user'].'.'.$authInfo['pass']; |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * @return void |
46 | 46 | */ |
47 | 47 | public static function proxyAuthentication(HttpSocket $http, &$proxyInfo) { |
48 | - $http->request['header']['Proxy-Authorization'] = 'Test ' . $proxyInfo['user'] . '.' . $proxyInfo['pass']; |
|
48 | + $http->request['header']['Proxy-Authorization'] = 'Test '.$proxyInfo['user'].'.'.$proxyInfo['pass']; |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | } |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | 'allow_self_signed' => false, |
321 | 321 | 'verify_depth' => 5, |
322 | 322 | 'CN_match' => 'www.cakephp.org', |
323 | - 'cafile' => CAKE . 'Config' . DS . 'cacert.pem' |
|
323 | + 'cafile' => CAKE.'Config'.DS.'cacert.pem' |
|
324 | 324 | ) |
325 | 325 | ); |
326 | 326 | |
@@ -556,10 +556,10 @@ discard block |
||
556 | 556 | $this->Socket->request($test['request']); |
557 | 557 | |
558 | 558 | $raw = $expectation['request']['raw']; |
559 | - $expectation['request']['raw'] = $expectation['request']['line'] . $expectation['request']['header'] . "\r\n" . $raw; |
|
559 | + $expectation['request']['raw'] = $expectation['request']['line'].$expectation['request']['header']."\r\n".$raw; |
|
560 | 560 | |
561 | 561 | $r = array('config' => $this->Socket->config, 'request' => $this->Socket->request); |
562 | - $this->assertEquals($r, $expectation, 'Failed test #' . $i . ' '); |
|
562 | + $this->assertEquals($r, $expectation, 'Failed test #'.$i.' '); |
|
563 | 563 | $expectation['request']['raw'] = $raw; |
564 | 564 | } |
565 | 565 | |
@@ -631,13 +631,13 @@ discard block |
||
631 | 631 | $request = array('uri' => 'htpp://www.cakephp.org/'); |
632 | 632 | $number = mt_rand(0, 9999999); |
633 | 633 | $this->Socket->expects($this->any())->method('connect')->will($this->returnValue(true)); |
634 | - $serverResponse = "HTTP/1.x 200 OK\r\nDate: Mon, 16 Apr 2007 04:14:16 GMT\r\nServer: CakeHttp Server\r\nContent-Type: text/html\r\n\r\n<h1>Hello, your lucky number is " . $number . "</h1>"; |
|
634 | + $serverResponse = "HTTP/1.x 200 OK\r\nDate: Mon, 16 Apr 2007 04:14:16 GMT\r\nServer: CakeHttp Server\r\nContent-Type: text/html\r\n\r\n<h1>Hello, your lucky number is ".$number."</h1>"; |
|
635 | 635 | $this->Socket->expects($this->at(0))->method('write') |
636 | 636 | ->with("GET / HTTP/1.1\r\nHost: www.cakephp.org\r\nConnection: close\r\nUser-Agent: CakePHP\r\n\r\n"); |
637 | 637 | $this->Socket->expects($this->at(0))->method('read')->will($this->returnValue(false)); |
638 | 638 | $this->Socket->expects($this->at(1))->method('read')->will($this->returnValue($serverResponse)); |
639 | - $response = (string)$this->Socket->request($request); |
|
640 | - $this->assertEquals($response, "<h1>Hello, your lucky number is " . $number . "</h1>"); |
|
639 | + $response = (string) $this->Socket->request($request); |
|
640 | + $this->assertEquals($response, "<h1>Hello, your lucky number is ".$number."</h1>"); |
|
641 | 641 | } |
642 | 642 | |
643 | 643 | /** |
@@ -702,21 +702,21 @@ discard block |
||
702 | 702 | $this->Socket->expects($this->at(4))->method('read')->will($this->returnValue($serverResponse)); |
703 | 703 | $this->Socket->connected = true; |
704 | 704 | |
705 | - $f = fopen(TMP . 'download.txt', 'w'); |
|
706 | - if (!$f) { |
|
705 | + $f = fopen(TMP.'download.txt', 'w'); |
|
706 | + if ( ! $f) { |
|
707 | 707 | $this->markTestSkipped('Can not write in TMP directory.'); |
708 | 708 | } |
709 | 709 | |
710 | 710 | $this->Socket->setContentResource($f); |
711 | - $result = (string)$this->Socket->request('http://www.cakephp.org/'); |
|
711 | + $result = (string) $this->Socket->request('http://www.cakephp.org/'); |
|
712 | 712 | $this->assertEquals('', $result); |
713 | 713 | $this->assertEquals('CakeHttp Server', $this->Socket->response['header']['Server']); |
714 | 714 | fclose($f); |
715 | - $this->assertEquals(file_get_contents(TMP . 'download.txt'), '<h1>This is a test!</h1>'); |
|
716 | - unlink(TMP . 'download.txt'); |
|
715 | + $this->assertEquals(file_get_contents(TMP.'download.txt'), '<h1>This is a test!</h1>'); |
|
716 | + unlink(TMP.'download.txt'); |
|
717 | 717 | |
718 | 718 | $this->Socket->setContentResource(false); |
719 | - $result = (string)$this->Socket->request('http://www.cakephp.org/'); |
|
719 | + $result = (string) $this->Socket->request('http://www.cakephp.org/'); |
|
720 | 720 | $this->assertEquals('<h1>This is a test!</h1>', $result); |
721 | 721 | } |
722 | 722 | |
@@ -1654,11 +1654,11 @@ discard block |
||
1654 | 1654 | |
1655 | 1655 | $escape = $this->Socket->tokenEscapeChars(false); |
1656 | 1656 | foreach ($escape as $char) { |
1657 | - $token = 'My-special-' . $char . '-Token'; |
|
1657 | + $token = 'My-special-'.$char.'-Token'; |
|
1658 | 1658 | $escapedToken = $this->Socket->escapeToken($token); |
1659 | - $expectedToken = 'My-special-"' . $char . '"-Token'; |
|
1659 | + $expectedToken = 'My-special-"'.$char.'"-Token'; |
|
1660 | 1660 | |
1661 | - $this->assertEquals($expectedToken, $escapedToken, 'Test token escaping for ASCII ' . ord($char)); |
|
1661 | + $this->assertEquals($expectedToken, $escapedToken, 'Test token escaping for ASCII '.ord($char)); |
|
1662 | 1662 | } |
1663 | 1663 | |
1664 | 1664 | $token = 'Extreme-:Token- -"@-test'; |
@@ -1742,7 +1742,7 @@ discard block |
||
1742 | 1742 | * @return void |
1743 | 1743 | */ |
1744 | 1744 | public function testVerifyPeer() { |
1745 | - $this->skipIf(!extension_loaded('openssl'), 'OpenSSL is not enabled cannot test SSL.'); |
|
1745 | + $this->skipIf( ! extension_loaded('openssl'), 'OpenSSL is not enabled cannot test SSL.'); |
|
1746 | 1746 | $socket = new HttpSocket(); |
1747 | 1747 | try { |
1748 | 1748 | $socket->get('https://typography.com'); |
@@ -1777,7 +1777,7 @@ discard block |
||
1777 | 1777 | */ |
1778 | 1778 | public function testResponseStatusParsing($status, $msg = '') { |
1779 | 1779 | $this->Socket->connected = true; |
1780 | - $serverResponse = $status . "\r\nDate: Mon, 16 Apr 2007 04:14:16 GMT\r\nServer: CakeHttp Server\r\n\r\n<h1>This is a test!</h1>"; |
|
1780 | + $serverResponse = $status."\r\nDate: Mon, 16 Apr 2007 04:14:16 GMT\r\nServer: CakeHttp Server\r\n\r\n<h1>This is a test!</h1>"; |
|
1781 | 1781 | $this->Socket->expects($this->at(1))->method('read')->will($this->returnValue($serverResponse)); |
1782 | 1782 | $this->Socket->expects($this->at(2))->method('read')->will($this->returnValue(false)); |
1783 | 1783 |