diff --git a/lib/Cake/Console/Command/Task/ExtractTask.php b/lib/Cake/Console/Command/Task/ExtractTask.php index a9c029196f2..f0525411a38 100644 --- a/lib/Cake/Console/Command/Task/ExtractTask.php +++ b/lib/Cake/Console/Command/Task/ExtractTask.php @@ -182,17 +182,6 @@ public function execute() { $this->_extractCore = strtolower($response) === 'y'; } - if (!empty($this->params['exclude-plugins']) && $this->_isExtractingApp()) { - $this->_exclude = array_merge($this->_exclude, App::path('plugins')); - } - - if (!empty($this->params['ignore-model-validation']) || (!$this->_isExtractingApp() && empty($plugin))) { - $this->_extractValidation = false; - } - if (!empty($this->params['validation-domain'])) { - $this->_validationDomain = $this->params['validation-domain']; - } - if (!empty($this->params['exclude-plugins']) && $this->_isExtractingApp()) { $this->_exclude = array_merge($this->_exclude, App::path('Plugin')); } diff --git a/lib/Cake/Console/Shell.php b/lib/Cake/Console/Shell.php index 5be8fccab69..1567ee707c3 100644 --- a/lib/Cake/Console/Shell.php +++ b/lib/Cake/Console/Shell.php @@ -263,6 +263,10 @@ public function __isset($name) { if ($name === $class) { return $this->loadModel($modelClass); } + list(, $class) = namespaceSplit($modelClass); + if ($name === $class) { + return $this->loadModel($class); + } } } } @@ -291,7 +295,9 @@ public function loadModel($modelClass = null, $id = null) { } $this->{$modelClass} = ClassRegistry::init(array( - 'class' => $plugin . $modelClass, 'alias' => $modelClass, 'id' => $id + 'class' => $plugin . $modelClass, + 'alias' => $modelClass, + 'id' => $id )); if (!$this->{$modelClass}) { throw new MissingModelException($modelClass); diff --git a/lib/Cake/Controller/Component/Auth/BaseAuthenticate.php b/lib/Cake/Controller/Component/Auth/BaseAuthenticate.php index 85024a0a3be..26962a14f92 100644 --- a/lib/Cake/Controller/Component/Auth/BaseAuthenticate.php +++ b/lib/Cake/Controller/Component/Auth/BaseAuthenticate.php @@ -164,12 +164,12 @@ public function getUser(Request $request) { /** * Handle unauthenticated access attempt. * - * @param CakeRequest $request A request object. - * @param CakeResponse $response A response object. + * @param Cake\Network\Request $request A request object. + * @param Cake\Network\Response $response A response object. * @return mixed Either true to indicate the unauthenticated request has been * dealt with and no more action is required by AuthComponent or void (default). */ - public function unauthenticated(CakeRequest $request, CakeResponse $response) { + public function unauthenticated(Request $request, Response $response) { } } diff --git a/lib/Cake/Controller/Component/Auth/BasicAuthenticate.php b/lib/Cake/Controller/Component/Auth/BasicAuthenticate.php index 888f02395cd..aff0c56e3a3 100644 --- a/lib/Cake/Controller/Component/Auth/BasicAuthenticate.php +++ b/lib/Cake/Controller/Component/Auth/BasicAuthenticate.php @@ -92,20 +92,10 @@ public function __construct(ComponentCollection $collection, $settings) { * @param Cake\Network\Response $response The response to add headers to. * @return mixed Either false on failure, or an array of user data on success. */ - public function authenticate(CakeRequest $request, CakeResponse $response) { + public function authenticate(Request $request, Response $response) { return $this->getUser($request); } -/** - * Get a user based on information in the request. Used by cookie-less auth for stateless clients. - * - * @param CakeRequest $request Request object. - * @return mixed Either false or an array of user information - */ - public function getUser(CakeRequest $request) { - $username = env('PHP_AUTH_USER'); - } - /** * Get a user based on information in the request. Used by cookie-less auth for stateless clients. * @@ -129,7 +119,7 @@ public function getUser(Request $request) { * @param CakeResponse $response A response object. * @return boolean True */ - public function unauthenticated(CakeRequest $request, CakeResponse $response) { + public function unauthenticated(Request $request, Response $response) { $response->header($this->loginHeaders()); $response->statusCode(401); $response->send(); diff --git a/lib/Cake/Model/ConnectionManager.php b/lib/Cake/Model/ConnectionManager.php index cb54762d96d..23e42eff897 100644 --- a/lib/Cake/Model/ConnectionManager.php +++ b/lib/Cake/Model/ConnectionManager.php @@ -98,7 +98,7 @@ public static function getDataSource($name) { $class = static::loadDataSource($name); - if (strpos(App::location($class), 'Datasource') === false) { + if (strpos($class, '\Datasource') === false) { throw new Error\MissingDatasourceException(array( 'class' => $class, 'plugin' => null, diff --git a/lib/Cake/Test/TestCase/BasicsTest.php b/lib/Cake/Test/TestCase/BasicsTest.php index 13012963c48..75a5f854284 100644 --- a/lib/Cake/Test/TestCase/BasicsTest.php +++ b/lib/Cake/Test/TestCase/BasicsTest.php @@ -874,78 +874,6 @@ public function testPrCli() { $this->assertEquals($expected, $result); } -/** - * test stripslashes_deep() - * - * @return void - */ - public function testStripslashesDeep() { - $this->skipIf(ini_get('magic_quotes_sybase') === '1', 'magic_quotes_sybase is on.'); - - $this->assertEquals(stripslashes_deep("tes\'t"), "tes't"); - $this->assertEquals(stripslashes_deep('tes\\' . chr(0) . 't'), 'tes' . chr(0) . 't'); - $this->assertEquals(stripslashes_deep('tes\"t'), 'tes"t'); - $this->assertEquals(stripslashes_deep("tes\'t"), "tes't"); - $this->assertEquals(stripslashes_deep('te\\st'), 'test'); - - $nested = array( - 'a' => "tes\'t", - 'b' => 'tes\\' . chr(0) . 't', - 'c' => array( - 'd' => 'tes\"t', - 'e' => "te\'s\'t", - array('f' => "tes\'t") - ), - 'g' => 'te\\st' - ); - $expected = array( - 'a' => "tes't", - 'b' => 'tes' . chr(0) . 't', - 'c' => array( - 'd' => 'tes"t', - 'e' => "te's't", - array('f' => "tes't") - ), - 'g' => 'test' - ); - $this->assertEquals($expected, stripslashes_deep($nested)); - } - -/** - * test stripslashes_deep() with magic_quotes_sybase on - * - * @return void - */ - public function testStripslashesDeepSybase() { - if (!(ini_get('magic_quotes_sybase') === '1')) { - $this->markTestSkipped('magic_quotes_sybase is off'); - } - - $this->assertEquals(stripslashes_deep("tes\'t"), "tes\'t"); - - $nested = array( - 'a' => "tes't", - 'b' => "tes''t", - 'c' => array( - 'd' => "tes'''t", - 'e' => "tes''''t", - array('f' => "tes''t") - ), - 'g' => "te'''''st" - ); - $expected = array( - 'a' => "tes't", - 'b' => "tes't", - 'c' => array( - 'd' => "tes''t", - 'e' => "tes''t", - array('f' => "tes't") - ), - 'g' => "te'''st" - ); - $this->assertEquals($expected, stripslashes_deep($nested)); - } - /** * test pluginSplit * diff --git a/lib/Cake/Test/TestCase/Console/Command/Task/ExtractTaskTest.php b/lib/Cake/Test/TestCase/Console/Command/Task/ExtractTaskTest.php index 2d219a64692..e3f246c369d 100644 --- a/lib/Cake/Test/TestCase/Console/Command/Task/ExtractTaskTest.php +++ b/lib/Cake/Test/TestCase/Console/Command/Task/ExtractTaskTest.php @@ -248,7 +248,9 @@ public function testExtractExcludePlugins() { array('_isExtractingApp', '_extractValidationMessages', 'in', 'out', 'err', 'clear', '_stop'), array($this->out, $this->out, $this->in) ); - $this->Task->expects($this->exactly(2))->method('_isExtractingApp')->will($this->returnValue(true)); + $this->Task->expects($this->exactly(2)) + ->method('_isExtractingApp') + ->will($this->returnValue(true)); $this->Task->params['paths'] = CAKE . 'Test/TestApp/'; $this->Task->params['output'] = $this->path . DS; @@ -305,7 +307,9 @@ public function testExtractModelValidation() { array('_isExtractingApp', 'in', 'out', 'err', 'clear', '_stop'), array($this->out, $this->out, $this->in) ); - $this->Task->expects($this->exactly(2))->method('_isExtractingApp')->will($this->returnValue(true)); + $this->Task->expects($this->exactly(2)) + ->method('_isExtractingApp') + ->will($this->returnValue(true)); $this->Task->params['paths'] = CAKE . 'Test/TestApp/'; $this->Task->params['output'] = $this->path . DS; diff --git a/lib/Cake/Test/TestCase/Console/ShellTest.php b/lib/Cake/Test/TestCase/Console/ShellTest.php index f32567f72ee..d057b172e11 100644 --- a/lib/Cake/Test/TestCase/Console/ShellTest.php +++ b/lib/Cake/Test/TestCase/Console/ShellTest.php @@ -16,12 +16,24 @@ use Cake\Console\Shell; use Cake\Core\App; +use Cake\Core\Configure; use Cake\Core\Plugin; use Cake\Log\Log; use Cake\TestSuite\TestCase; use Cake\Utility\Folder; use Cake\Utility\Hash; +/** + * Class for testing merging vars + */ +class MergeShell extends Shell { + + public $tasks = array('DbConfig', 'Fixture'); + + public $uses = array('Comment'); + +} + /** * ShellTestShell class * @@ -158,6 +170,7 @@ public function testInitialize() { 'Plugin' => array(CAKE . 'Test/TestApp/Plugin/'), 'Model' => array(CAKE . 'Test/TestApp/Model/') ), App::RESET); + Configure::write('App.namespace', 'TestApp'); Plugin::load('TestPlugin'); $this->Shell->uses = array('TestPlugin.TestPluginPost'); @@ -172,7 +185,7 @@ public function testInitialize() { $this->Shell->initialize(); $this->assertTrue(isset($this->Shell->Comment)); $this->assertInstanceOf('TestApp\Model\Comment', $this->Shell->Comment); - $this->assertEquals('Comment', $this->Shell->modelClass); + $this->assertEquals('TestApp\Model\Comment', $this->Shell->modelClass); App::build(); } @@ -184,23 +197,24 @@ public function testInitialize() { */ public function testLoadModel() { App::build(array( - 'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS), - 'Model' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Model' . DS) + 'Plugin' => array(CAKE . 'Test' . DS . 'TestApp' . DS . 'Plugin' . DS), + 'Model' => array(CAKE . 'Test' . DS . 'TestApp' . DS . 'Model' . DS) ), App::RESET); + Configure::write('App.namespace', 'TestApp'); - $Shell = new TestMergeShell(); + $Shell = new MergeShell(); $this->assertEquals('Comment', $Shell->Comment->alias); - $this->assertInstanceOf('Comment', $Shell->Comment); + $this->assertInstanceOf('TestApp\Model\Comment', $Shell->Comment); $this->assertEquals('Comment', $Shell->modelClass); - CakePlugin::load('TestPlugin'); + Plugin::load('TestPlugin'); $this->Shell->loadModel('TestPlugin.TestPluginPost'); $this->assertTrue(isset($this->Shell->TestPluginPost)); - $this->assertInstanceOf('TestPluginPost', $this->Shell->TestPluginPost); + $this->assertInstanceOf('TestPlugin\Model\TestPluginPost', $this->Shell->TestPluginPost); $this->assertEquals('TestPluginPost', $this->Shell->modelClass); - CakePlugin::unload('TestPlugin'); App::build(); + Plugin::unload('TestPlugin'); } /** diff --git a/lib/Cake/Test/TestCase/Controller/Component/AuthComponentTest.php b/lib/Cake/Test/TestCase/Controller/Component/AuthComponentTest.php index da4fce4b29e..c81694951c2 100644 --- a/lib/Cake/Test/TestCase/Controller/Component/AuthComponentTest.php +++ b/lib/Cake/Test/TestCase/Controller/Component/AuthComponentTest.php @@ -24,6 +24,7 @@ use Cake\Controller\Controller; use Cake\Core\App; use Cake\Core\Configure; +use Cake\Model\Datasource\Session; use Cake\Network\Request; use Cake\Network\Response; use Cake\Routing\Dispatcher; @@ -1104,9 +1105,9 @@ public function testUser() { * @return void */ public function testStatelessAuthNoRedirect() { - if (CakeSession::id()) { + if (Session::id()) { session_destroy(); - CakeSession::$id = null; + Session::$id = null; } $_SESSION = null; @@ -1125,7 +1126,7 @@ public function testStatelessAuthNoRedirect() { $this->assertFalse($result); $this->assertNull($this->Controller->testUrl); - $this->assertNull(CakeSession::id()); + $this->assertNull(Session::id()); } /** @@ -1134,9 +1135,9 @@ public function testStatelessAuthNoRedirect() { * @return void */ public function testStatelessAuthNoSessionStart() { - if (CakeSession::id()) { + if (Session::id()) { session_destroy(); - CakeSession::$id = null; + Session::$id = null; } $_SESSION = null; @@ -1151,7 +1152,7 @@ public function testStatelessAuthNoSessionStart() { $result = $this->Auth->startup($this->Controller); $this->assertTrue($result); - $this->assertNull(CakeSession::id()); + $this->assertNull(Session::id()); } /** diff --git a/lib/Cake/Test/TestCase/View/Helper/FormHelperTest.php b/lib/Cake/Test/TestCase/View/Helper/FormHelperTest.php index 3f3a58c6683..9ffeb5d0278 100644 --- a/lib/Cake/Test/TestCase/View/Helper/FormHelperTest.php +++ b/lib/Cake/Test/TestCase/View/Helper/FormHelperTest.php @@ -5872,7 +5872,7 @@ public function testMonth() { $result = $this->Form->month('Project.release'); $expected = array( - array('select' => array('name' => 'data[Project][release][month]', 'id' => 'ProjectReleaseMonth')), + array('select' => array('name' => 'Project[release][month]', 'id' => 'ProjectReleaseMonth')), array('option' => array('value' => '')), '/option', array('option' => array('value' => '01')), @@ -5977,7 +5977,7 @@ public function testDay() { $result = $this->Form->day('Project.release'); $expected = array( - array('select' => array('name' => 'data[Project][release][day]', 'id' => 'ProjectReleaseDay')), + array('select' => array('name' => 'Project[release][day]', 'id' => 'ProjectReleaseDay')), array('option' => array('value' => '')), '/option', array('option' => array('value' => '01')), @@ -6168,7 +6168,7 @@ public function testHour() { $this->Form->request->data['Model']['field'] = '2050-10-10 01:12:32'; $result = $this->Form->hour('Model.field', true); $expected = array( - array('select' => array('name' => 'data[Model][field][hour]', 'id' => 'ModelFieldHour')), + array('select' => array('name' => 'Model[field][hour]', 'id' => 'ModelFieldHour')), array('option' => array('value' => '')), '/option', array('option' => array('value' => '00')), diff --git a/lib/Cake/TestSuite/Fixture/FixtureManager.php b/lib/Cake/TestSuite/Fixture/FixtureManager.php index 6c19d8462f2..a50c5542af3 100644 --- a/lib/Cake/TestSuite/Fixture/FixtureManager.php +++ b/lib/Cake/TestSuite/Fixture/FixtureManager.php @@ -234,7 +234,6 @@ public function unload(TestCase $test) { * @throws UnexpectedValueException if $name is not a previously loaded class */ public function loadSingle($name, $db = null, $dropTables = true) { - $name .= 'Fixture'; if (isset($this->_fixtureMap[$name])) { $fixture = $this->_fixtureMap[$name]; if (!$db) { diff --git a/lib/Cake/Utility/Xml.php b/lib/Cake/Utility/Xml.php index f586fe1d0c1..ce32280c4e9 100644 --- a/lib/Cake/Utility/Xml.php +++ b/lib/Cake/Utility/Xml.php @@ -24,6 +24,7 @@ use Cake\Core\Configure; use Cake\Error; use Cake\Network\Http\Client; +use \DOMDocument; /** * XML handling for Cake. diff --git a/lib/Cake/View/Helper/FormHelper.php b/lib/Cake/View/Helper/FormHelper.php index 9862b861f39..8ea2399dfaa 100644 --- a/lib/Cake/View/Helper/FormHelper.php +++ b/lib/Cake/View/Helper/FormHelper.php @@ -23,6 +23,7 @@ use Cake\Utility\Security; use Cake\View\Helper; use Cake\View\View; +use \DateTime; /** * Form helper library.