|
|
@@ -134,13 +134,7 @@ class TestFixture implements FixtureInterface
|
|
|
public function init()
|
|
|
{
|
|
|
if ($this->table === null) {
|
|
|
- list(, $class) = namespaceSplit(get_class($this));
|
|
|
- preg_match('/^(.*)Fixture$/', $class, $matches);
|
|
|
- $table = $class;
|
|
|
- if (isset($matches[1])) {
|
|
|
- $table = $matches[1];
|
|
|
- }
|
|
|
- $this->table = Inflector::tableize($table);
|
|
|
+ $this->table = $this->_tableFromClass();
|
|
|
}
|
|
|
|
|
|
if (empty($this->import) && !empty($this->fields)) {
|
|
|
@@ -157,6 +151,24 @@ class TestFixture implements FixtureInterface
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * Returns the table name using the fixture class
|
|
|
+ *
|
|
|
+ * @return string
|
|
|
+ */
|
|
|
+ protected function _tableFromClass()
|
|
|
+ {
|
|
|
+ list(, $class) = namespaceSplit(get_class($this));
|
|
|
+ preg_match('/^(.*)Fixture$/', $class, $matches);
|
|
|
+ $table = $class;
|
|
|
+
|
|
|
+ if (isset($matches[1])) {
|
|
|
+ $table = $matches[1];
|
|
|
+ }
|
|
|
+
|
|
|
+ return Inflector::tableize($table);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* Build the fixtures table schema from the fields property.
|
|
|
*
|
|
|
* @return void
|