Skip to content

Commit

Permalink
up to installer v3
Browse files Browse the repository at this point in the history
  • Loading branch information
jeyroik committed Jun 5, 2020
1 parent b632b7f commit ff0cfa0
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 37 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"require-dev": {
"phpunit/phpunit": "^9",
"vlucas/phpdotenv": "^3.4",
"jeyroik/extas-repositories-mongo": "1.*"
"jeyroik/extas-repositories-mongo": "1.*",
"jeyroik/extas-snuffbox": "0.*"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 1 addition & 1 deletion extas.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "extas/workflow-dispatchers",

"installer_version": 3,
"workflow_transition_dispatcher_samples": [
{
"name": "datetime",
Expand Down
24 changes: 8 additions & 16 deletions tests/DateTimeTest.php
Original file line number Diff line number Diff line change
@@ -1,45 +1,37 @@
<?php
namespace tests;

use Dotenv\Dotenv;
use PHPUnit\Framework\TestCase;

use extas\components\repositories\TSnuffRepository;
use extas\components\conditions\Condition;
use extas\components\conditions\ConditionEqual;
use extas\components\conditions\ConditionRepository;
use extas\components\workflows\transits\TransitResult;
use extas\interfaces\conditions\IConditionRepository;
use extas\interfaces\repositories\IRepository;
use extas\components\SystemContainer;
use extas\components\workflows\entities\Entity;
use extas\components\workflows\transitions\dispatchers\DateTime;

use Dotenv\Dotenv;
use PHPUnit\Framework\TestCase;

/**
* Class DateTimeTest
*
* @author jeyroik@gmail.com
*/
class DateTimeTest extends TestCase
{
protected ?IRepository $condRepo = null;
use TSnuffRepository;

protected function setUp(): void
{
parent::setUp();
$env = Dotenv::create(getcwd() . '/tests/');
$env->load();

$this->condRepo = new ConditionRepository();

SystemContainer::addItem(
IConditionRepository::class,
ConditionRepository::class
);
$this->registerSnuffRepos(['conditionRepository' => ConditionRepository::class]);
}

public function tearDown(): void
{
$this->condRepo->delete([Condition::FIELD__NAME => 'eq']);
$this->unregisterSnuffRepos();
}

public function testConditionFailed()
Expand All @@ -51,7 +43,7 @@ public function testConditionFailed()
'datetime' => time()-100,
'compare' => '='
]);
$this->condRepo->create(new Condition([
$this->createWithSnuffRepo('conditionRepository', new Condition([
Condition::FIELD__NAME => 'eq',
Condition::FIELD__ALIASES => ['eq', '='],
Condition::FIELD__CLASS => ConditionEqual::class
Expand Down
24 changes: 8 additions & 16 deletions tests/FieldValueCompareTest.php
Original file line number Diff line number Diff line change
@@ -1,45 +1,37 @@
<?php
namespace tests;

use PHPUnit\Framework\TestCase;
use Dotenv\Dotenv;

use extas\components\repositories\TSnuffRepository;
use extas\components\conditions\Condition;
use extas\components\conditions\ConditionEqual;
use extas\components\conditions\ConditionRepository;
use extas\components\workflows\transits\TransitResult;
use extas\interfaces\conditions\IConditionRepository;
use extas\interfaces\repositories\IRepository;
use extas\components\SystemContainer;
use extas\components\workflows\entities\Entity;
use extas\components\workflows\transitions\dispatchers\FieldValueCompare;

use PHPUnit\Framework\TestCase;
use Dotenv\Dotenv;

/**
* Class FieldValueCompareTest
*
* @author jeyroik@gmail.com
*/
class FieldValueCompareTest extends TestCase
{
protected ?IRepository $condRepo = null;
use TSnuffRepository;

protected function setUp(): void
{
parent::setUp();
$env = Dotenv::create(getcwd() . '/tests/');
$env->load();

$this->condRepo = new ConditionRepository();

SystemContainer::addItem(
IConditionRepository::class,
ConditionRepository::class
);
$this->registerSnuffRepos(['conditionRepository' => ConditionRepository::class]);
}

public function tearDown(): void
{
$this->condRepo->delete([Condition::FIELD__NAME => 'eq']);
$this->unregisterSnuffRepos();
}

public function testConditionFailed()
Expand All @@ -55,7 +47,7 @@ public function testConditionFailed()
'field_compare' => '='
]);

$this->condRepo->create(new Condition([
$this->createWithSnuffRepo('conditionRepository', new Condition([
Condition::FIELD__NAME => 'eq',
Condition::FIELD__ALIASES => ['eq', '='],
Condition::FIELD__CLASS => ConditionEqual::class
Expand Down
6 changes: 3 additions & 3 deletions tests/NotifyTest.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?php
namespace tests;

use Dotenv\Dotenv;
use extas\components\workflows\entities\EntityContext;
use PHPUnit\Framework\TestCase;

use extas\components\workflows\transitions\dispatchers\Notify;
use extas\components\workflows\transits\TransitResult;
use extas\components\workflows\entities\Entity;

use Dotenv\Dotenv;
use PHPUnit\Framework\TestCase;

/**
* Class NotifyTest
*
Expand Down

0 comments on commit ff0cfa0

Please sign in to comment.