diff --git a/.travis.yml b/.travis.yml index 113d99a5c3b..05d40bbe79d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,7 +28,6 @@ matrix: - php: hhvm-nightly env: HHVM=1 DB=mysql db_class='Cake\Database\Driver\Mysql' db_dsn='mysql:host=0.0.0.0;dbname=cakephp_test' db_database='cakephp_test' db_login='travis' db_password='' - before_script: - composer self-update - composer install --prefer-source --no-interaction --dev diff --git a/src/Cache/Engine/ApcEngine.php b/src/Cache/Engine/ApcEngine.php index 22d61d0ae9b..95865931a90 100644 --- a/src/Cache/Engine/ApcEngine.php +++ b/src/Cache/Engine/ApcEngine.php @@ -14,9 +14,9 @@ */ namespace Cake\Cache\Engine; +use APCIterator; use Cake\Cache\CacheEngine; use Cake\Utility\Inflector; -use APCIterator; /** * APC storage engine for cache diff --git a/src/Console/Command/Task/ExtractTask.php b/src/Console/Command/Task/ExtractTask.php index 5a2261199e2..2682600793c 100644 --- a/src/Console/Command/Task/ExtractTask.php +++ b/src/Console/Command/Task/ExtractTask.php @@ -1,7 +1,5 @@ charset + * @return string this->charset */ public function charset($charset = null) { if ($charset === null) { @@ -547,7 +549,7 @@ public function charset($charset = null) { * HeaderCharset setter/getter * * @param string $charset Character set. - * @return string $this->charset + * @return string this->charset */ public function headerCharset($charset = null) { if ($charset === null) { @@ -562,8 +564,8 @@ public function headerCharset($charset = null) { * @param string $regex for email address validation * @return string|$this */ - public function emailPattern($regex = null) { - if ($regex === null) { + public function emailPattern($regex = false) { + if ($regex === false) { return $this->_emailPattern; } $this->_emailPattern = $regex; @@ -609,13 +611,12 @@ protected function _setEmail($varName, $email, $name) { * @throws \Cake\Network\Error\SocketException If email address does not validate */ protected function _validateEmail($email) { - $valid = (($this->_emailPattern !== null && - preg_match($this->_emailPattern, $email)) || - filter_var($email, FILTER_VALIDATE_EMAIL) - ); - if (!$valid) { - throw new Error\SocketException(sprintf('Invalid email: "%s"', $email)); + if ($this->_emailPattern === null && filter_var($email, FILTER_VALIDATE_EMAIL)) { + return; + } elseif (preg_match($this->_emailPattern, $email)) { + return; } + throw new Error\SocketException(__d('cake_dev', 'Invalid email: "%s"', $email)); } /** diff --git a/src/Network/Request.php b/src/Network/Request.php index f322d5bbfce..9251253feee 100644 --- a/src/Network/Request.php +++ b/src/Network/Request.php @@ -611,7 +611,7 @@ public function is($type) { * * @param array $types The types to check. * @return bool Success. - * @see Request::is() + * @see \Cake\Network\Request::is() */ public function isAll(array $types) { $result = array_filter(array_map(array($this, 'is'), $types)); diff --git a/src/Network/Response.php b/src/Network/Response.php index e7a22be2b97..df02d3fa386 100644 --- a/src/Network/Response.php +++ b/src/Network/Response.php @@ -1142,7 +1142,7 @@ public function length($bytes = null) { * the Last-Modified etag response header before calling this method. Otherwise * a comparison will not be possible. * - * @param Request $request Request object + * @param \Cake\Network\Request $request Request object * @return bool whether the response was marked as not modified or not. */ public function checkNotModified(Request $request) { @@ -1288,7 +1288,7 @@ public function cors(Request $request, $allowedDomains, $allowedMethods = array( /** * Normalize the origin to regular expressions and put in an array format * - * @param array $domains Domain names. + * @param array $domains Domain names to normalize. * @param bool $requestIsSSL Whether it's a SSL request. * @return array */ diff --git a/src/Routing/Route/RedirectRoute.php b/src/Routing/Route/RedirectRoute.php index 2db0896f251..34a1bfdc3e4 100644 --- a/src/Routing/Route/RedirectRoute.php +++ b/src/Routing/Route/RedirectRoute.php @@ -107,4 +107,5 @@ public function parse($url) { public function match(array $url, array $context = array()) { return false; } + } diff --git a/src/Template/Error/fatal_error.ctp b/src/Template/Error/fatal_error.ctp index 44fcf628db1..63c6ed4eae6 100644 --- a/src/Template/Error/fatal_error.ctp +++ b/src/Template/Error/fatal_error.ctp @@ -1,6 +1,5 @@ 's', ), 'uninflected' => array( - '.*[nrlm]ese', '.*deer', '.*fish', '.*measles', '.*ois', '.*pox', '.*sheep', 'people', 'feedback' + '.*[nrlm]ese', + '.*deer', + '.*fish', + '.*measles', + '.*ois', + '.*pox', + '.*sheep', + 'people', + 'feedback', + 'stadia' ), 'irregular' => array( 'atlas' => 'atlases', diff --git a/src/Validation/Validation.php b/src/Validation/Validation.php index 89e5816e5a1..340e3653646 100644 --- a/src/Validation/Validation.php +++ b/src/Validation/Validation.php @@ -415,7 +415,7 @@ public static function boolean($check) { * - true => Any number of decimal places greater than 0, or a float|double. The '.' is required. * - 1..N => Exactly that many number of decimal places. The '.' is required. * - * @param float $check The value the test for decimal + * @param float $check The value the test for decimal. * @param int $places Decimal places. * @param string $regex If a custom regular expression is used, this is the only validation that will occur. * @return bool Success diff --git a/src/View/View.php b/src/View/View.php index d4604c7b98e..7875344f1a2 100644 --- a/src/View/View.php +++ b/src/View/View.php @@ -91,7 +91,6 @@ class View { /** * Name of the controller that created the View if any. * - * @see Controller::$name * @var string */ public $name = null; diff --git a/src/bootstrap.php b/src/bootstrap.php index f6f021a314d..4ebe2df59b9 100644 --- a/src/bootstrap.php +++ b/src/bootstrap.php @@ -1,9 +1,5 @@ Task->main('article'); } -/** - * test that execute passes runs bake depending with named model. - * - * @return void - */ - public function testMainWithNamedModel() { - $this->Task->connection = 'test'; - $filename = $this->_normalizePath(ROOT . '/Test/Fixture/ArticleFixture.php'); - - $this->Task->expects($this->at(0)) - ->method('createFile') - ->with($filename, $this->stringContains('class ArticleFixture')); - - $this->Task->main('article'); - } - /** * test that execute passes runs bake depending with named model. * diff --git a/tests/TestCase/Console/ConsoleErrorHandlerTest.php b/tests/TestCase/Console/ConsoleErrorHandlerTest.php index 37d41e885ce..3052b9f781d 100644 --- a/tests/TestCase/Console/ConsoleErrorHandlerTest.php +++ b/tests/TestCase/Console/ConsoleErrorHandlerTest.php @@ -135,4 +135,31 @@ public function testError500Exception() { $this->Error->handleException($exception); } +/** + * test a exception with non-integer code + * + * @return void + */ + public function testNonIntegerExceptionCode() { + if (PHP_VERSION_ID < 50300) { + $this->markTestSkipped('ReflectionProperty::setAccessible() is available since 5.3'); + } + + $exception = new Exception('Non-integer exception code'); + + $class = new ReflectionClass('Exception'); + $property = $class->getProperty('code'); + $property->setAccessible(true); + $property->setValue($exception, '42S22'); + + ConsoleErrorHandler::$stderr->expects($this->once())->method('write') + ->with($this->stringContains('Non-integer exception code')); + + $this->Error->expects($this->once()) + ->method('_stop') + ->with(1); + + $this->Error->handleException($exception); + } + } diff --git a/tests/TestCase/Log/Engine/SyslogLogTest.php b/tests/TestCase/Log/Engine/SyslogLogTest.php index c7cb42ed2b3..e882ed176c4 100644 --- a/tests/TestCase/Log/Engine/SyslogLogTest.php +++ b/tests/TestCase/Log/Engine/SyslogLogTest.php @@ -1,6 +1,5 @@ * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * diff --git a/tests/TestCase/Network/Email/EmailTest.php b/tests/TestCase/Network/Email/EmailTest.php index 6b5b0b4a864..94da760fb14 100644 --- a/tests/TestCase/Network/Email/EmailTest.php +++ b/tests/TestCase/Network/Email/EmailTest.php @@ -196,12 +196,16 @@ public function testTo() { $this->assertSame($this->CakeEmail->to(), $expected); $list = array( + 'root@localhost' => 'root', + 'bjørn@hammeröath.com' => 'Bjorn', 'cake@cakephp.org' => 'Cake PHP', 'cake-php@googlegroups.com' => 'Cake Groups', 'root@cakephp.org' ); $this->CakeEmail->to($list); $expected = array( + 'root@localhost' => 'root', + 'bjørn@hammeröath.com' => 'Bjorn', 'cake@cakephp.org' => 'Cake PHP', 'cake-php@googlegroups.com' => 'Cake Groups', 'root@cakephp.org' => 'root@cakephp.org' @@ -212,6 +216,8 @@ public function testTo() { $this->CakeEmail->addTo('mark_story@cakephp.org', 'Mark Story'); $result = $this->CakeEmail->addTo(array('phpnut@cakephp.org' => 'PhpNut', 'jose_zap@cakephp.org')); $expected = array( + 'root@localhost' => 'root', + 'bjørn@hammeröath.com' => 'Bjorn', 'cake@cakephp.org' => 'Cake PHP', 'cake-php@googlegroups.com' => 'Cake Groups', 'root@cakephp.org' => 'root@cakephp.org', @@ -222,9 +228,6 @@ public function testTo() { ); $this->assertSame($this->CakeEmail->to(), $expected); $this->assertSame($this->CakeEmail, $result); - - $this->setExpectedException('Cake\Network\Error\SocketException'); - $this->CakeEmail->to(array('cake@localhost', 'CakePHP')); } /** @@ -238,8 +241,6 @@ public static function invalidEmails() { array(''), array('string'), array(''), - array('some@one-whereis'), - array('wrong@key' => 'Name'), array(array('ok@cakephp.org', 1.0, '', 'string')) ); } @@ -273,7 +274,6 @@ public function testInvalidEmailAdd($value) { */ public function testEmailPattern() { $regex = '/.+@.+\..+/i'; - $this->assertNull($this->CakeEmail->emailPattern()); $this->assertSame($regex, $this->CakeEmail->emailPattern($regex)->emailPattern()); } diff --git a/tests/TestCase/Utility/InflectorTest.php b/tests/TestCase/Utility/InflectorTest.php index 065516e6ce0..f31d35e7901 100644 --- a/tests/TestCase/Utility/InflectorTest.php +++ b/tests/TestCase/Utility/InflectorTest.php @@ -238,6 +238,7 @@ public function testInflectingPlurals() { $this->assertEquals(Inflector::pluralize('curve'), 'curves'); $this->assertEquals(Inflector::pluralize('body_curve'), 'body_curves'); $this->assertEquals(Inflector::pluralize('metadata'), 'metadata'); + $this->assertEquals(Inflector::pluralize('stadia'), 'stadia'); $this->assertEquals(Inflector::pluralize(''), ''); } diff --git a/tests/test_app/Plugin/TestPlugin/src/Routing/Filter/TestDispatcherFilter.php b/tests/test_app/Plugin/TestPlugin/src/Routing/Filter/TestDispatcherFilter.php index 0996d5aa698..f9c4dd9bd4c 100644 --- a/tests/test_app/Plugin/TestPlugin/src/Routing/Filter/TestDispatcherFilter.php +++ b/tests/test_app/Plugin/TestPlugin/src/Routing/Filter/TestDispatcherFilter.php @@ -1,6 +1,5 @@