using memory db tables makes tests which use a db a lot faster.

a *lot* faster
This commit is contained in:
AD7six 2011-05-14 18:08:11 +02:00
parent 9f374363b5
commit 75998ca918

View file

@ -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
); );