appendixes/mysite/code/testing/FakeManager.php 1 location
|
@@ 42-50 (lines=9) @@
|
| 39 |
|
* |
| 40 |
|
* @param FakeDatabase $db |
| 41 |
|
*/ |
| 42 |
|
function __construct($db = null) { |
| 43 |
|
$testState = Injector::inst()->get('TestSessionEnvironment')->getState(); |
| 44 |
|
|
| 45 |
|
if(!$db) { |
| 46 |
|
$db = new FakeDatabase($testState->fakeDatabasePath); |
| 47 |
|
} |
| 48 |
|
|
| 49 |
|
$this->db = $db; |
| 50 |
|
} |
| 51 |
|
|
| 52 |
|
public function setDb($db) { |
| 53 |
|
$this->db = $db; |
appendixes/mysite/code/testing/FakeManagerTestSessionExtension.php 1 location
|
@@ 119-130 (lines=12) @@
|
| 116 |
|
* We can't reset Behat CLI runs through this measure because the CLI has a persistent connection |
| 117 |
|
* to the underlying SQLite database file, so the browser can't remove it. |
| 118 |
|
*/ |
| 119 |
|
protected function resetFakeManager() { |
| 120 |
|
$state = $this->owner->getState(); |
| 121 |
|
|
| 122 |
|
if($state) { |
| 123 |
|
$manager = Injector::inst()->get( |
| 124 |
|
'FakeManager', |
| 125 |
|
true, |
| 126 |
|
array(new FakeDatabase($state->fakeDatabasePath)) |
| 127 |
|
); |
| 128 |
|
$manager->getDb()->reset(); |
| 129 |
|
} |
| 130 |
|
} |
| 131 |
|
|
| 132 |
|
} |
| 133 |
|
|