mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-09-06 19:42:41 +00:00
Merge remote-tracking branch 'origin/1.3' into merger
Conflicts: cake/console/cake.php cake/dispatcher.php cake/libs/controller/components/auth.php cake/libs/controller/controller.php cake/libs/view/helpers/xml.php cake/libs/view/pages/home.ctp cake/libs/xml.php cake/tests/cases/console/cake.test.php cake/tests/cases/libs/controller/components/cookie.test.php cake/tests/cases/libs/model/datasources/dbo/dbo_mysql.test.php cake/tests/cases/libs/model/datasources/dbo_source.test.php cake/tests/cases/libs/view/helpers/xml.test.php cake/tests/cases/libs/xml.test.php lib/Cake/Console/Command/SchemaShell.php lib/Cake/Controller/Component/CookieComponent.php lib/Cake/Network/Http/HttpSocket.php lib/Cake/TestSuite/Fixture/CakeTestFixture.php lib/Cake/VERSION.txt lib/Cake/View/Helper/FormHelper.php lib/Cake/View/Helper/TextHelper.php lib/Cake/View/Helper/TimeHelper.php lib/Cake/config/config.php lib/Cake/tests/Case/Cache/CacheTest.php lib/Cake/tests/Case/Model/CakeSchemaTest.php lib/Cake/tests/Case/TestSuite/CakeTestFixtureTest.php
This commit is contained in:
commit
d83555cc52
22 changed files with 357 additions and 76 deletions
|
@ -70,7 +70,7 @@ class CakeTestFixture {
|
|||
public function init() {
|
||||
if (isset($this->import) && (is_string($this->import) || is_array($this->import))) {
|
||||
$import = array_merge(
|
||||
array('connection' => 'default', 'records' => false),
|
||||
array('connection' => 'default', 'records' => false),
|
||||
is_array($this->import) ? $this->import : array('model' => $this->import)
|
||||
);
|
||||
|
||||
|
@ -178,9 +178,15 @@ class CakeTestFixture {
|
|||
if (!isset($this->_insert)) {
|
||||
$values = array();
|
||||
if (isset($this->records) && !empty($this->records)) {
|
||||
$fields = array();
|
||||
foreach($this->records as $record) {
|
||||
$fields = array_merge($fields, array_keys(array_intersect_key($record, $this->fields)));
|
||||
}
|
||||
$fields = array_unique($fields);
|
||||
$default = array_fill_keys($fields, null);
|
||||
foreach ($this->records as $record) {
|
||||
$fields = array_keys($record);
|
||||
$values[] = array_values($record);
|
||||
$values[] = array_values(array_merge($default, $record));
|
||||
}
|
||||
return $db->insertMulti($this->table, $fields, $values);
|
||||
}
|
||||
|
@ -188,6 +194,7 @@ class CakeTestFixture {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Truncates the current fixture. Can be overwritten by classes extending CakeFixture to trigger other events before / after
|
||||
* truncate.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue