mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 17:16:18 +00:00
Merge branch 'master' into 2.4
This commit is contained in:
commit
81dc4c1e85
8 changed files with 34 additions and 22 deletions
|
@ -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';
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -78,7 +78,6 @@ class ConnectionManager {
|
|||
*
|
||||
* @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 @@ class ConnectionManager {
|
|||
$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;
|
||||
|
||||
|
|
|
@ -328,7 +328,7 @@ class HttpSocket extends CakeSocket {
|
|||
$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 @@ class HttpSocket extends CakeSocket {
|
|||
}
|
||||
|
||||
$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',
|
||||
|
|
|
@ -21,6 +21,9 @@ App::uses('Model', 'Model');
|
|||
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 {
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
require_once dirname(__FILE__) . DS . 'ModelTestBase.php';
|
||||
App::uses('DboSource', 'Model/Datasource');
|
||||
App::uses('DboMock', 'Model/Datasource');
|
||||
|
||||
/**
|
||||
* DboMock class
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -5560,23 +5560,6 @@ class FormHelperTest extends CakeTestCase {
|
|||
);
|
||||
$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 @@ class FormHelperTest extends CakeTestCase {
|
|||
$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 @@ class FormHelperTest extends CakeTestCase {
|
|||
)
|
||||
);
|
||||
$result = $this->Form->dateTime('Contact.date', 'DMY', '12', array('empty' => false));
|
||||
$this->assertNotEmpty($result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Add table
Reference in a new issue