Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' into 2.4

  • Loading branch information...
commit 81dc4c1e857dd77ea2774191e1077d5430c51a5d 2 parents abe6511 + 274a146
@markstory markstory authored
View
2  lib/Cake/Error/exceptions.php
@@ -441,7 +441,7 @@ class MissingDatasourceConfigException extends CakeException {
*/
class MissingDatasourceException extends CakeException {
- protected $_messageTemplate = 'Datasource class %s could not be found.';
+ protected $_messageTemplate = 'Datasource class %s could not be found. %s';
}
View
8 lib/Cake/Model/ConnectionManager.php
@@ -78,7 +78,6 @@ protected static function _init() {
*
* @param string $name The name of the DataSource, as defined in app/Config/database.php
* @return DataSource Instance
- * @throws MissingDatasourceConfigException
* @throws MissingDatasourceException
*/
public static function getDataSource($name) {
@@ -99,6 +98,13 @@ public static function getDataSource($name) {
$conn = self::$_connectionsEnum[$name];
$class = $conn['classname'];
+ if (strpos(App::location($class), 'Datasource') === false) {
+ throw new MissingDatasourceException(array(
+ 'class' => $class,
+ 'plugin' => null,
+ 'message' => 'Datasource is not found in Model/Datasource package.'
+ ));
+ }
self::$_dataSources[$name] = new $class(self::$config->{$name});
self::$_dataSources[$name]->configKeyName = $name;
View
4 lib/Cake/Network/Http/HttpSocket.php
@@ -328,7 +328,7 @@ public function request($request = array()) {
$this->request['auth'] = $this->_auth;
if (is_array($this->request['body'])) {
- $this->request['body'] = http_build_query($this->request['body']);
+ $this->request['body'] = http_build_query($this->request['body'], '', '&');
}
if (!empty($this->request['body']) && !isset($this->request['header']['Content-Type'])) {
@@ -696,7 +696,7 @@ protected function _buildUri($uri = array(), $uriTemplate = '%scheme://%user:%pa
}
$uri['path'] = preg_replace('/^\//', null, $uri['path']);
- $uri['query'] = http_build_query($uri['query']);
+ $uri['query'] = http_build_query($uri['query'], '', '&');
$uri['query'] = rtrim($uri['query'], '=');
$stripIfEmpty = array(
'query' => '?%query',
View
3  lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php
@@ -21,6 +21,9 @@
App::uses('AppModel', 'Model');
App::uses('DataSource', 'Model/Datasource');
App::uses('DboSource', 'Model/Datasource');
+App::uses('DboTestSource', 'Model/Datasource');
+App::uses('DboSecondTestSource', 'Model/Datasource');
+App::uses('MockDataSource', 'Model/Datasource');
require_once dirname(dirname(__FILE__)) . DS . 'models.php';
class MockPDO extends PDO {
View
1  lib/Cake/Test/Case/Model/ModelIntegrationTest.php
@@ -20,6 +20,7 @@
require_once dirname(__FILE__) . DS . 'ModelTestBase.php';
App::uses('DboSource', 'Model/Datasource');
+App::uses('DboMock', 'Model/Datasource');
/**
* DboMock class
View
5 lib/Cake/Test/Case/Model/ModelWriteTest.php
@@ -17,6 +17,11 @@
* @since CakePHP(tm) v 1.2.0.4206
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
+App::uses('MockTransactionDboSource', 'Model/Datasource');
+App::uses('MockTransactionAssociatedDboSource', 'Model/Datasource');
+App::uses('MockManyTransactionDboSource', 'Model/Datasource');
+App::uses('MockAssociatedTransactionDboSource', 'Model/Datasource');
+
require_once dirname(__FILE__) . DS . 'ModelTestBase.php';
/**
* ModelWriteTest
View
30 lib/Cake/Test/Case/View/Helper/FormHelperTest.php
@@ -5560,23 +5560,6 @@ public function testDateTime() {
);
$this->assertTags($result, $expected);
- $result = $this->Form->input('published', array('type' => 'time'));
- $now = strtotime('now');
- $expected = array(
- 'div' => array('class' => 'input time'),
- 'label' => array('for' => 'ContactPublishedHour'),
- 'Published',
- '/label',
- array('select' => array('name' => 'data[Contact][published][hour]', 'id' => 'ContactPublishedHour')),
- 'preg:/(?:<option value="([\d])+">[\d]+<\/option>[\r\n]*)*/',
- array('option' => array('value' => date('h', $now), 'selected' => 'selected')),
- date('g', $now),
- '/option',
- '*/select',
- ':',
- );
- $this->assertTags($result, $expected);
-
$result = $this->Form->input('published', array(
'timeFormat' => 24,
'interval' => 5,
@@ -5589,7 +5572,17 @@ public function testDateTime() {
$this->assertRegExp('/<option[^<>]+value="13"[^<>]+selected="selected"[^>]*>13<\/option>/', $result);
$this->assertRegExp('/<option[^<>]+value="35"[^<>]+selected="selected"[^>]*>35<\/option>/', $result);
- $this->assertNoErrors();
+ $result = $this->Form->input('published', array('type' => 'time'));
+ $now = strtotime('now');
+ $this->assertContains('<option value="' . date('h', $now) . '" selected="selected">' . date('g', $now) . '</option>', $result);
+ }
+
+/**
+ * Test that empty values don't trigger errors.
+ *
+ * @return void
+ */
+ public function testDateTimeNoErrorsOnEmptyData() {
$this->Form->request->data['Contact'] = array(
'date' => array(
'day' => '',
@@ -5601,6 +5594,7 @@ public function testDateTime() {
)
);
$result = $this->Form->dateTime('Contact.date', 'DMY', '12', array('empty' => false));
+ $this->assertNotEmpty($result);
}
/**
View
3  lib/Cake/View/Errors/missing_datasource.ctp
@@ -22,6 +22,9 @@ $pluginDot = empty($plugin) ? null : $plugin . '.';
<p class="error">
<strong><?php echo __d('cake_dev', 'Error'); ?>: </strong>
<?php echo __d('cake_dev', 'Datasource class %s could not be found.', '<em>' . $pluginDot . $class . '</em>'); ?>
+ <?php if (isset($message)): ?>
+ <?php echo h($message); ?>
+ <?php endif; ?>
</p>
<p class="notice">
<strong><?php echo __d('cake_dev', 'Notice'); ?>: </strong>
Please sign in to comment.
Something went wrong with that request. Please try again.