mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-06-06 14:53:36 +00:00
Merge branch 'master' into 2.5
This commit is contained in:
commit
71312932e8
4 changed files with 22 additions and 19 deletions
lib/Cake
Model
Network/Http
Test/Case
|
@ -1127,10 +1127,13 @@ class Model extends Object implements CakeEventListener {
|
||||||
public function setSource($tableName) {
|
public function setSource($tableName) {
|
||||||
$this->setDataSource($this->useDbConfig);
|
$this->setDataSource($this->useDbConfig);
|
||||||
$db = ConnectionManager::getDataSource($this->useDbConfig);
|
$db = ConnectionManager::getDataSource($this->useDbConfig);
|
||||||
$db->cacheSources = ($this->cacheSources && $db->cacheSources);
|
|
||||||
|
|
||||||
if (method_exists($db, 'listSources')) {
|
if (method_exists($db, 'listSources')) {
|
||||||
|
$restore = $db->cacheSources;
|
||||||
|
$db->cacheSources = ($restore && $this->cacheSources);
|
||||||
$sources = $db->listSources();
|
$sources = $db->listSources();
|
||||||
|
$db->cacheSources = $restore;
|
||||||
|
|
||||||
if (is_array($sources) && !in_array(strtolower($this->tablePrefix . $tableName), array_map('strtolower', $sources))) {
|
if (is_array($sources) && !in_array(strtolower($this->tablePrefix . $tableName), array_map('strtolower', $sources))) {
|
||||||
throw new MissingTableException(array(
|
throw new MissingTableException(array(
|
||||||
'table' => $this->tablePrefix . $tableName,
|
'table' => $this->tablePrefix . $tableName,
|
||||||
|
|
|
@ -689,8 +689,8 @@ class HttpSocket extends CakeSocket {
|
||||||
}
|
}
|
||||||
if (!empty($this->config['context']['ssl']['verify_host'])) {
|
if (!empty($this->config['context']['ssl']['verify_host'])) {
|
||||||
$this->config['context']['ssl']['CN_match'] = $host;
|
$this->config['context']['ssl']['CN_match'] = $host;
|
||||||
unset($this->config['context']['ssl']['verify_host']);
|
|
||||||
}
|
}
|
||||||
|
unset($this->config['context']['ssl']['verify_host']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -155,17 +155,17 @@ class ModelIntegrationTest extends BaseModelTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests that $cacheSources can only be disabled in the db using model settings, not enabled
|
* Tests that $cacheSources is restored despite the settings on the model.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testCacheSourcesDisabling() {
|
public function testCacheSourcesRestored() {
|
||||||
$this->loadFixtures('JoinA', 'JoinB', 'JoinAB', 'JoinC', 'JoinAC');
|
$this->loadFixtures('JoinA', 'JoinB', 'JoinAB', 'JoinC', 'JoinAC');
|
||||||
$this->db->cacheSources = true;
|
$this->db->cacheSources = true;
|
||||||
$TestModel = new JoinA();
|
$TestModel = new JoinA();
|
||||||
$TestModel->cacheSources = false;
|
$TestModel->cacheSources = false;
|
||||||
$TestModel->setSource('join_as');
|
$TestModel->setSource('join_as');
|
||||||
$this->assertFalse($this->db->cacheSources);
|
$this->assertTrue($this->db->cacheSources);
|
||||||
|
|
||||||
$this->db->cacheSources = false;
|
$this->db->cacheSources = false;
|
||||||
$TestModel = new JoinA();
|
$TestModel = new JoinA();
|
||||||
|
|
|
@ -720,36 +720,36 @@ class RssHelperTest extends CakeTestCase {
|
||||||
|
|
||||||
public function testElementNamespaceWithPrefix() {
|
public function testElementNamespaceWithPrefix() {
|
||||||
$item = array(
|
$item = array(
|
||||||
'title' => 'Title',
|
'title' => 'Title',
|
||||||
'dc:creator' => 'Alex',
|
'dc:creator' => 'Alex',
|
||||||
'xy:description' => 'descriptive words'
|
'xy:description' => 'descriptive words'
|
||||||
);
|
);
|
||||||
$attributes = array(
|
$attributes = array(
|
||||||
'namespace' => array(
|
'namespace' => array(
|
||||||
'prefix' => 'dc',
|
'prefix' => 'dc',
|
||||||
'url' => 'http://link.com'
|
'url' => 'http://link.com'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$result = $this->Rss->item($attributes, $item);
|
$result = $this->Rss->item($attributes, $item);
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'item' => array(
|
'item' => array(
|
||||||
'xmlns:dc' => 'http://link.com'
|
'xmlns:dc' => 'http://link.com'
|
||||||
),
|
),
|
||||||
'title' => array(
|
'title' => array(
|
||||||
'xmlns:dc' => 'http://link.com'
|
'xmlns:dc' => 'http://link.com'
|
||||||
),
|
),
|
||||||
'Title',
|
'Title',
|
||||||
'/title',
|
'/title',
|
||||||
'dc:creator' => array(
|
'dc:creator' => array(
|
||||||
'xmlns:dc' => 'http://link.com'
|
'xmlns:dc' => 'http://link.com'
|
||||||
),
|
),
|
||||||
'Alex',
|
'Alex',
|
||||||
'/dc:creator',
|
'/dc:creator',
|
||||||
'description' => array(
|
'xy:description' => array(
|
||||||
'xmlns:dc' => 'http://link.com'
|
'xmlns:dc' => 'http://link.com'
|
||||||
),
|
),
|
||||||
'descriptive words',
|
'descriptive words',
|
||||||
'/description',
|
'/xy:description',
|
||||||
'/item'
|
'/item'
|
||||||
);
|
);
|
||||||
$this->assertTags($result, $expected, true);
|
$this->assertTags($result, $expected, true);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue