mirror of
https://github.com/silverstripe/silverstripe-testsession
synced 2024-10-22 14:06:00 +02:00
Merge pull request #11 from mateusz/add-guard
BUG Add a guard to prevent Behat runs from failing.
This commit is contained in:
commit
2a13ce2d08
@ -278,10 +278,12 @@ class TestSessionEnvironment extends Object {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
file_put_contents(
|
if (defined('JSON_PRETTY_PRINT')) {
|
||||||
$this->getFilePath(),
|
$content = json_encode($state, JSON_PRETTY_PRINT);
|
||||||
json_encode($state, JSON_PRETTY_PRINT)
|
} else {
|
||||||
);
|
$content = json_encode($state);
|
||||||
|
}
|
||||||
|
file_put_contents($this->getFilePath(), $content);
|
||||||
|
|
||||||
$this->extend('onAfterApplyState');
|
$this->extend('onAfterApplyState');
|
||||||
}
|
}
|
||||||
@ -383,4 +385,4 @@ class TestSessionEnvironment extends Object {
|
|||||||
$path = Director::getAbsFile($this->getFilePath());
|
$path = Director::getAbsFile($this->getFilePath());
|
||||||
return (file_exists($path)) ? json_decode(file_get_contents($path)) : new stdClass;
|
return (file_exists($path)) ? json_decode(file_get_contents($path)) : new stdClass;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user