mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 19:16:16 +00:00
using memory db tables makes tests which use a db a lot faster.
a *lot* faster
This commit is contained in:
parent
9f374363b5
commit
75998ca918
1 changed files with 23 additions and 0 deletions
|
@ -145,7 +145,30 @@ class CakeTestFixture {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (empty($this->fields['tableParameters']['engine'])) {
|
||||||
|
$canUseMemory = true;
|
||||||
|
foreach($this->fields as $field => $args) {
|
||||||
|
|
||||||
|
if (is_string($args)) {
|
||||||
|
$type = $args;
|
||||||
|
} elseif (!empty($args['type'])) {
|
||||||
|
$type = $args['type'];
|
||||||
|
} else {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_array($type, array('blob', 'text'))) {
|
||||||
|
$canUseMemory = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($canUseMemory) {
|
||||||
|
$this->fields['tableParameters']['engine'] = 'MEMORY';
|
||||||
|
}
|
||||||
|
}
|
||||||
$this->Schema->build(array($this->table => $this->fields));
|
$this->Schema->build(array($this->table => $this->fields));
|
||||||
|
|
||||||
return (
|
return (
|
||||||
$db->execute($db->createSchema($this->Schema), array('log' => false)) !== false
|
$db->execute($db->createSchema($this->Schema), array('log' => false)) !== false
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Reference in a new issue