Revert: API Update for filesystem refactor [15b491e]

This commit is contained in:
Jeffrey Guo 2016-02-05 16:20:53 +13:00
parent c424b5f1fa
commit 3a292d796b
3 changed files with 18 additions and 17 deletions

View File

@ -32,7 +32,7 @@
"symfony/yaml": "~2.0",
"symfony/finder": "~2.0",
"silverstripe/testsession": "*",
"silverstripe/framework": "^4.0.0"
"silverstripe/framework": "~3.1"
},
"autoload": {

View File

@ -2,10 +2,13 @@
namespace SilverStripe\BehatExtension\Context;
use Behat\Behat\Context\BehatContext,
use Behat\Behat\Context\ClosuredContextInterface,
Behat\Behat\Context\TranslatedContextInterface,
Behat\Behat\Context\BehatContext,
Behat\Behat\Context\Step,
Behat\Behat\Event\StepEvent,
Behat\Behat\Event\ScenarioEvent;
Behat\Behat\Event\ScenarioEvent,
Behat\Behat\Exception\PendingException;
use Behat\Mink\Driver\Selenium2Driver;
@ -265,9 +268,8 @@ JS;
*/
public function cleanAssetsAfterScenario(ScenarioEvent $event) {
foreach(\File::get() as $file) {
$file->delete();
if(file_exists($file->getFullPath())) $file->delete();
}
\Filesystem::removeFolder(ASSETS_PATH, true);
}
public function takeScreenshot(StepEvent $event) {

View File

@ -2,11 +2,17 @@
namespace SilverStripe\BehatExtension\Context;
use Behat\Behat\Context\BehatContext,
use Behat\Behat\Context\ClosuredContextInterface,
Behat\Behat\Context\TranslatedContextInterface,
Behat\Behat\Context\BehatContext,
Behat\Behat\Context\Step,
Behat\Behat\Event\StepEvent,
Behat\Behat\Event\FeatureEvent,
Behat\Behat\Event\ScenarioEvent,
Behat\Behat\Exception\PendingException,
Behat\Mink\Driver\Selenium2Driver,
Behat\Gherkin\Node\PyStringNode,
Behat\Gherkin\Node\TableNode,
SilverStripe\Filesystem\Storage\AssetStore;
Behat\Gherkin\Node\TableNode;
// PHPUnit
require_once 'PHPUnit/Autoload.php';
@ -542,7 +548,8 @@ class FixtureContext extends BehatContext
protected function prepareAsset($class, $identifier, $data = null) {
if(!$data) $data = array();
$relativeTargetPath = (isset($data['Filename'])) ? $data['Filename'] : $identifier;
$relativeTargetPath = preg_replace('/^' . ASSETS_DIR . '\/?/', '', $relativeTargetPath);
$relativeTargetPath = preg_replace('/^' . ASSETS_DIR . '/', '', $relativeTargetPath);
$targetPath = $this->joinPaths(ASSETS_PATH, $relativeTargetPath);
$sourcePath = $this->joinPaths($this->getFilesPath(), basename($relativeTargetPath));
// Create file or folder on filesystem
@ -587,14 +594,6 @@ class FixtureContext extends BehatContext
return $data;
}
/**
*
* @return AssetStore
*/
protected function getAssetStore() {
return singleton('AssetStore');
}
/**
* Converts a natural language class description to an actual class name.
* Respects {@link DataObject::$singular_name} variations.