Commit 98994c79 authored by Ludovic Ganée's avatar Ludovic Ganée

Utilisation du FixtureManager pour les tests

parent 2b7d0d1d
Pipeline #8903 failed with stage
in 16 seconds
tmp/
vendor/
composer.lock
.idea/
......
......@@ -12,7 +12,7 @@
"php": ">=5.6",
"ext-json": "*",
"pda/pheanstalk": "~3.1",
"cakephp/cakephp": "^3.8 || ^4.0"
"cakephp/cakephp": "^3.8"
},
"suggest": {
"cakephp/migrations": "Pour une installation via le plugin migration (voir config/Migrations/)"
......
......@@ -17,6 +17,16 @@
</testsuite>
</testsuites>
<listeners>
<listener
class="\Cake\TestSuite\Fixture\FixtureInjector"
file="./vendor/cakephp/cakephp/src/TestSuite/Fixture/FixtureInjector.php">
<arguments>
<object class="\Cake\TestSuite\Fixture\FixtureManager" />
</arguments>
</listener>
</listeners>
<filter>
<whitelist>
<directory suffix=".php">./src/</directory>
......
......@@ -39,17 +39,6 @@ class BeanstalkJobTest extends TestCase
*/
private $BeanstalkJobs;
public function __construct($name = null, array $data = [], $dataName = '')
{
parent::__construct($name, $data, $dataName);
if (empty($this->fixtureManager)) {
$this->fixtureManager = new FixtureManager;
$this->fixtureManager->fixturize($this);
$this->loadFixtures();
}
Cache::disable();
}
public function setUp()
{
parent::setUp();
......
......@@ -25,17 +25,6 @@ class WorkerShellTest extends TestCase
'app.BeanstalkJobs',
];
public function __construct($name = null, array $data = [], $dataName = '')
{
parent::__construct($name, $data, $dataName);
if (empty($this->fixtureManager)) {
$this->fixtureManager = new FixtureManager;
$this->fixtureManager->fixturize($this);
$this->loadFixtures();
}
Cache::disable();
}
public function setUp()
{
parent::setUp();
......
......@@ -23,17 +23,6 @@ class BeanstalkTest extends TestCase
'app.BeanstalkJobs',
];
public function __construct($name = null, array $data = [], $dataName = '')
{
parent::__construct($name, $data, $dataName);
if (empty($this->fixtureManager)) {
$this->fixtureManager = new FixtureManager;
$this->fixtureManager->fixturize($this);
$this->loadFixtures();
}
Cache::disable();
}
public function setUp()
{
parent::setUp();
......
......@@ -6,6 +6,7 @@
* unit tests in this file.
*/
use Cake\Cache\Cache;
use Cake\Core\Configure;
require dirname(__DIR__) . '/vendor/autoload.php';
......@@ -66,4 +67,29 @@ if (!Configure::read('App')) {
],
]
);
Cache::setConfig(
[
'default' => [
'className' => 'File',
'path' => CACHE,
'url' => env('CACHE_DEFAULT_URL', null),
],
'_cake_core_' => [
'className' => 'File',
'prefix' => 'myapp_cake_core_',
'path' => CACHE . 'persistent/',
'serialize' => true,
'duration' => '+1 years',
'url' => env('CACHE_CAKECORE_URL', null),
],
'_cake_model_' => [
'className' => 'File',
'prefix' => 'myapp_cake_model_',
'path' => CACHE . 'models/',
'serialize' => true,
'duration' => '+1 years',
'url' => env('CACHE_CAKEMODEL_URL', null),
],
]
);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment