From 55d4acc7442240e85870737053bc79b1e8176dac Mon Sep 17 00:00:00 2001 From: Boris KOUMONDJI Date: Sun, 12 Feb 2017 18:42:29 +0100 Subject: [PATCH 01/83] Use symfony workflow version ^3.2 and add unit test --- LICENSE | 2 +- README.md | 49 +- composer.json | 20 +- composer.lock | 2357 +++++++++++++++++ config/config.php | 200 +- phpunit.xml | 25 + .../Commands/WorkflowDumpCommand.php} | 29 +- .../Events/EventDispatcher.php | 11 +- .../Facades/WorkflowFacade.php | 2 +- src/LaravelWorkflow/ServiceProvider.php | 50 + src/LaravelWorkflow/WorkflowRegistry.php | 110 + .../WorkflowServiceProvider.php | 88 - straight.png | Bin 0 -> 10381 bytes tests/WorkflowDumpCommandTest.php | 63 + tests/WorkflowRegistryTest.php | 78 + 15 files changed, 2765 insertions(+), 319 deletions(-) create mode 100644 composer.lock create mode 100644 phpunit.xml rename src/{Picr/LaravelWorkflow/Commands/WorkflowGraphvizDumpCommand.php => LaravelWorkflow/Commands/WorkflowDumpCommand.php} (64%) rename src/{Picr => }/LaravelWorkflow/Events/EventDispatcher.php (87%) rename src/{Picr => }/LaravelWorkflow/Facades/WorkflowFacade.php (81%) create mode 100644 src/LaravelWorkflow/ServiceProvider.php create mode 100644 src/LaravelWorkflow/WorkflowRegistry.php delete mode 100644 src/Picr/LaravelWorkflow/WorkflowServiceProvider.php create mode 100644 straight.png create mode 100644 tests/WorkflowDumpCommandTest.php create mode 100644 tests/WorkflowRegistryTest.php diff --git a/LICENSE b/LICENSE index beca08b..b36f86c 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2016 PICR +Copyright (c) 2016 BREXIS Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index a8a3098..3e6d4f5 100644 --- a/README.md +++ b/README.md @@ -2,15 +2,9 @@ Use the Symfony Workflow component in Laravel -### Composer Configuration - -Include the laravel-workflow package as a dependency in your `composer.json`: - - "picr/laravel-workflow": "dev-master" - ### Installation -Run `composer install` to download the dependencies. + composer require brexis/laravel-workflow #### Laravel 5 @@ -18,8 +12,8 @@ Add a ServiceProvider to your providers array in `config/app.php`: ```php 'providers' => [ - - 'Picr\LaravelWorkflow\LaravelWorkflowServiceProvider', + ... + 'LaravelWorkflow\ServiceProvider', ] ``` @@ -27,5 +21,40 @@ Add a ServiceProvider to your providers array in `config/app.php`: Add the `Workflow` facade to your facades array: ```php - 'Workflow' => 'Picr\LaravelWorkflow\Facades\WorkflowFacade', + 'Workflow' => 'LaravelWorkflow\Facades\WorkflowFacade', +``` + + +### Configuration + +Configure your workflow in `config/workflow.php` + +```php + [ + 'type' => 'workflow', // or 'state_machine' + 'marking_store' => [ + 'type' => 'multiple_state', + 'arguments' => ['currentPlace'] + ], + 'supports' => ['App\BlogPost'], + 'places' => ['draft', 'review', 'rejected', 'published'], + 'transitions' => [ + 'to_review' => [ + 'from' => 'draft', + 'to' => 'review' + ], + 'publish' => [ + 'from' => 'review', + 'to' => 'published' + ], + 'reject' => [ + 'from' => 'review', + 'to' => 'rejected' + ] + ], + ] +]; ``` diff --git a/composer.json b/composer.json index efac4d2..147a36c 100644 --- a/composer.json +++ b/composer.json @@ -1,16 +1,19 @@ { - "name": "picr/laravel-workflow", + "name": "brexis/laravel-workflow", "description": "Integerate Symfony Workflow component into Laravel.", - "keywords": ["workflow", "petri net", "laravel", "laravel5"], + "keywords": ["workflow", "symfony", "laravel", "laravel5"], "license": "MIT", "require": { - "php": ">=5.5.0", - "symfony/workflow": "^3.2@dev", - "symfony/property-access": "^3.2@dev" + "php": ">=5.5.9", + "symfony/workflow": "^3.2", + "symfony/process": "^3.2", + "symfony/event-dispatcher": "^3.2", + "mockery/mockery": "^0.9.8", + "illuminate/console": "^5.4" }, "autoload": { "psr-0": { - "Picr\\LaravelWorkflow": "src/" + "LaravelWorkflow": "src/" } }, "extra": { @@ -18,5 +21,8 @@ "dev-master": "1.0-dev" } }, - "minimum-stability": "dev" + "minimum-stability": "dev", + "require-dev": { + "phpunit/phpunit": "^6.0" + } } diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..103d237 --- /dev/null +++ b/composer.lock @@ -0,0 +1,2357 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "content-hash": "041bd3f181b681c0887f42d992ac07db", + "packages": [ + { + "name": "doctrine/inflector", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/doctrine/inflector.git", + "reference": "803a2ed9fea02f9ca47cd45395089fe78769a392" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/803a2ed9fea02f9ca47cd45395089fe78769a392", + "reference": "803a2ed9fea02f9ca47cd45395089fe78769a392", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "require-dev": { + "phpunit/phpunit": "4.*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Common\\Inflector\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Common String Manipulations with regard to casing and singular/plural rules.", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "inflection", + "pluralize", + "singularize", + "string" + ], + "time": "2016-05-12 17:23:41" + }, + { + "name": "hamcrest/hamcrest-php", + "version": "1.2.x-dev", + "source": { + "type": "git", + "url": "https://github.com/hamcrest/hamcrest-php.git", + "reference": "b72949ccf2f640e7de66ff7dd92d83f577ce782e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/hamcrest/hamcrest-php/zipball/b72949ccf2f640e7de66ff7dd92d83f577ce782e", + "reference": "b72949ccf2f640e7de66ff7dd92d83f577ce782e", + "shasum": "" + }, + "require": { + "php": "^5.3|^7.0" + }, + "replace": { + "cordoval/hamcrest-php": "*", + "davedevelopment/hamcrest-php": "*", + "kodova/hamcrest-php": "*" + }, + "require-dev": { + "phpunit/php-file-iterator": "1.3.3", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "^1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2-dev" + } + }, + "autoload": { + "classmap": [ + "hamcrest" + ], + "files": [ + "hamcrest/Hamcrest.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD" + ], + "description": "This is the PHP port of Hamcrest Matchers", + "keywords": [ + "test" + ], + "time": "2016-01-19 12:08:55" + }, + { + "name": "illuminate/console", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/illuminate/console.git", + "reference": "6d85ccd08b6337eb7275f1d4d1e70589d0b4af6c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/illuminate/console/zipball/6d85ccd08b6337eb7275f1d4d1e70589d0b4af6c", + "reference": "6d85ccd08b6337eb7275f1d4d1e70589d0b4af6c", + "shasum": "" + }, + "require": { + "illuminate/contracts": "5.5.*", + "illuminate/support": "5.5.*", + "nesbot/carbon": "~1.20", + "php": ">=7.0", + "symfony/console": "~3.2" + }, + "suggest": { + "guzzlehttp/guzzle": "Required to use the ping methods on schedules (~6.0).", + "mtdowling/cron-expression": "Required to use scheduling component (~1.0).", + "symfony/process": "Required to use scheduling component (~3.2)." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.5-dev" + } + }, + "autoload": { + "psr-4": { + "Illuminate\\Console\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "The Illuminate Console package.", + "homepage": "https://laravel.com", + "time": "2017-01-30 22:05:16" + }, + { + "name": "illuminate/contracts", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/illuminate/contracts.git", + "reference": "981b767f2eec48664ed0f7207a372ddf3c1ec5fb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/illuminate/contracts/zipball/981b767f2eec48664ed0f7207a372ddf3c1ec5fb", + "reference": "981b767f2eec48664ed0f7207a372ddf3c1ec5fb", + "shasum": "" + }, + "require": { + "php": ">=7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.5-dev" + } + }, + "autoload": { + "psr-4": { + "Illuminate\\Contracts\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "The Illuminate Contracts package.", + "homepage": "https://laravel.com", + "time": "2017-02-10 21:32:45" + }, + { + "name": "illuminate/support", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/illuminate/support.git", + "reference": "1ea50a4359bc346ad3f9a804ee43ba023fccd27c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/illuminate/support/zipball/1ea50a4359bc346ad3f9a804ee43ba023fccd27c", + "reference": "1ea50a4359bc346ad3f9a804ee43ba023fccd27c", + "shasum": "" + }, + "require": { + "doctrine/inflector": "~1.0", + "ext-mbstring": "*", + "illuminate/contracts": "5.5.*", + "php": ">=7.0" + }, + "replace": { + "tightenco/collect": "self.version" + }, + "suggest": { + "illuminate/filesystem": "Required to use the composer class (5.2.*).", + "symfony/process": "Required to use the composer class (~3.2).", + "symfony/var-dumper": "Required to use the dd function (~3.2)." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.5-dev" + } + }, + "autoload": { + "psr-4": { + "Illuminate\\Support\\": "" + }, + "files": [ + "helpers.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "The Illuminate Support package.", + "homepage": "https://laravel.com", + "time": "2017-02-12 14:42:51" + }, + { + "name": "mockery/mockery", + "version": "0.9.x-dev", + "source": { + "type": "git", + "url": "https://github.com/padraic/mockery.git", + "reference": "1e5e2ffdc4d71d7358ed58a6fdd30a4a0c506855" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/padraic/mockery/zipball/1e5e2ffdc4d71d7358ed58a6fdd30a4a0c506855", + "reference": "1e5e2ffdc4d71d7358ed58a6fdd30a4a0c506855", + "shasum": "" + }, + "require": { + "hamcrest/hamcrest-php": "~1.1", + "lib-pcre": ">=7.0", + "php": ">=5.3.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.9.x-dev" + } + }, + "autoload": { + "psr-0": { + "Mockery": "library/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Pádraic Brady", + "email": "padraic.brady@gmail.com", + "homepage": "http://blog.astrumfutura.com" + }, + { + "name": "Dave Marshall", + "email": "dave.marshall@atstsolutions.co.uk", + "homepage": "http://davedevelopment.co.uk" + } + ], + "description": "Mockery is a simple yet flexible PHP mock object framework for use in unit testing with PHPUnit, PHPSpec or any other testing framework. Its core goal is to offer a test double framework with a succinct API capable of clearly defining all possible object operations and interactions using a human readable Domain Specific Language (DSL). Designed as a drop in alternative to PHPUnit's phpunit-mock-objects library, Mockery is easy to integrate with PHPUnit and can operate alongside phpunit-mock-objects without the World ending.", + "homepage": "http://github.com/padraic/mockery", + "keywords": [ + "BDD", + "TDD", + "library", + "mock", + "mock objects", + "mockery", + "stub", + "test", + "test double", + "testing" + ], + "time": "2017-02-09 13:29:38" + }, + { + "name": "nesbot/carbon", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/briannesbitt/Carbon.git", + "reference": "926aee5ab38c2868816aa760f862a85ad01cb61a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/926aee5ab38c2868816aa760f862a85ad01cb61a", + "reference": "926aee5ab38c2868816aa760f862a85ad01cb61a", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "symfony/translation": "~2.6 || ~3.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "~2", + "phpunit/phpunit": "~4.0 || ~5.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.23-dev" + } + }, + "autoload": { + "psr-4": { + "Carbon\\": "src/Carbon/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Brian Nesbitt", + "email": "brian@nesbot.com", + "homepage": "http://nesbot.com" + } + ], + "description": "A simple API extension for DateTime.", + "homepage": "http://carbon.nesbot.com", + "keywords": [ + "date", + "datetime", + "time" + ], + "time": "2017-02-06 22:02:47" + }, + { + "name": "paragonie/random_compat", + "version": "v2.0.4", + "source": { + "type": "git", + "url": "https://github.com/paragonie/random_compat.git", + "reference": "a9b97968bcde1c4de2a5ec6cbd06a0f6c919b46e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/a9b97968bcde1c4de2a5ec6cbd06a0f6c919b46e", + "reference": "a9b97968bcde1c4de2a5ec6cbd06a0f6c919b46e", + "shasum": "" + }, + "require": { + "php": ">=5.2.0" + }, + "require-dev": { + "phpunit/phpunit": "4.*|5.*" + }, + "suggest": { + "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." + }, + "type": "library", + "autoload": { + "files": [ + "lib/random.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Paragon Initiative Enterprises", + "email": "security@paragonie.com", + "homepage": "https://paragonie.com" + } + ], + "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", + "keywords": [ + "csprng", + "pseudorandom", + "random" + ], + "time": "2016-11-07T23:38:38+00:00" + }, + { + "name": "psr/log", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2016-10-10 12:19:37" + }, + { + "name": "symfony/console", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "28698ac32c2694d4a3de8b17bf02fab2b7598ce0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/28698ac32c2694d4a3de8b17bf02fab2b7598ce0", + "reference": "28698ac32c2694d4a3de8b17bf02fab2b7598ce0", + "shasum": "" + }, + "require": { + "php": ">=5.5.9", + "symfony/debug": "~2.8|~3.0", + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/dependency-injection": "<3.3" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/dependency-injection": "~3.3", + "symfony/event-dispatcher": "~2.8|~3.0", + "symfony/filesystem": "~2.8|~3.0", + "symfony/http-kernel": "~2.8|~3.0", + "symfony/process": "~2.8|~3.0" + }, + "suggest": { + "psr/log": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/filesystem": "", + "symfony/process": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.3-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Console\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Console Component", + "homepage": "https://symfony.com", + "time": "2017-02-06 12:04:42" + }, + { + "name": "symfony/debug", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/symfony/debug.git", + "reference": "84a2c430d9dc835189cbd8739eb14ba94b5f4a07" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/debug/zipball/84a2c430d9dc835189cbd8739eb14ba94b5f4a07", + "reference": "84a2c430d9dc835189cbd8739eb14ba94b5f4a07", + "shasum": "" + }, + "require": { + "php": ">=5.5.9", + "psr/log": "~1.0" + }, + "conflict": { + "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" + }, + "require-dev": { + "symfony/http-kernel": "~2.8|~3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.3-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Debug\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Debug Component", + "homepage": "https://symfony.com", + "time": "2017-01-28 02:39:08" + }, + { + "name": "symfony/event-dispatcher", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "48e343e59e7c7f7cb6171b919082fb4a18df89a6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/48e343e59e7c7f7cb6171b919082fb4a18df89a6", + "reference": "48e343e59e7c7f7cb6171b919082fb4a18df89a6", + "shasum": "" + }, + "require": { + "php": ">=5.5.9" + }, + "conflict": { + "symfony/dependency-injection": "<3.3" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~2.8|~3.0", + "symfony/dependency-injection": "~3.3", + "symfony/expression-language": "~2.8|~3.0", + "symfony/stopwatch": "~2.8|~3.0" + }, + "suggest": { + "symfony/dependency-injection": "", + "symfony/http-kernel": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.3-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\EventDispatcher\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony EventDispatcher Component", + "homepage": "https://symfony.com", + "time": "2017-02-02 13:15:15" + }, + { + "name": "symfony/inflector", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/symfony/inflector.git", + "reference": "e16e5588af1e9b1956554333e742e2da41f787ea" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/inflector/zipball/e16e5588af1e9b1956554333e742e2da41f787ea", + "reference": "e16e5588af1e9b1956554333e742e2da41f787ea", + "shasum": "" + }, + "require": { + "php": ">=5.5.9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.3-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Inflector\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Inflector Component", + "homepage": "https://symfony.com", + "keywords": [ + "inflection", + "pluralize", + "singularize", + "string", + "symfony", + "words" + ], + "time": "2017-01-02 20:33:09" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "e79d363049d1c2128f133a2667e4f4190904f7f4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/e79d363049d1c2128f133a2667e4f4190904f7f4", + "reference": "e79d363049d1c2128f133a2667e4f4190904f7f4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "time": "2016-11-14 01:06:16" + }, + { + "name": "symfony/polyfill-php70", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php70.git", + "reference": "13ce343935f0f91ca89605a2f6ca6f5c2f3faac2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/13ce343935f0f91ca89605a2f6ca6f5c2f3faac2", + "reference": "13ce343935f0f91ca89605a2f6ca6f5c2f3faac2", + "shasum": "" + }, + "require": { + "paragonie/random_compat": "~1.0|~2.0", + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php70\\": "" + }, + "files": [ + "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2016-11-14 01:06:16" + }, + { + "name": "symfony/process", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/symfony/process.git", + "reference": "37d005254947477f31d6878996b9adcafb2d3c44" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/process/zipball/37d005254947477f31d6878996b9adcafb2d3c44", + "reference": "37d005254947477f31d6878996b9adcafb2d3c44", + "shasum": "" + }, + "require": { + "php": ">=5.5.9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.3-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Process\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Process Component", + "homepage": "https://symfony.com", + "time": "2017-02-08 15:45:40" + }, + { + "name": "symfony/property-access", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/symfony/property-access.git", + "reference": "51bc3ac8cb63c384e940180c00446c9368bf4be9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/property-access/zipball/51bc3ac8cb63c384e940180c00446c9368bf4be9", + "reference": "51bc3ac8cb63c384e940180c00446c9368bf4be9", + "shasum": "" + }, + "require": { + "php": ">=5.5.9", + "symfony/inflector": "~3.1", + "symfony/polyfill-php70": "~1.0" + }, + "require-dev": { + "symfony/cache": "~3.1" + }, + "suggest": { + "psr/cache-implementation": "To cache access methods." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.3-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\PropertyAccess\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony PropertyAccess Component", + "homepage": "https://symfony.com", + "keywords": [ + "access", + "array", + "extraction", + "index", + "injection", + "object", + "property", + "property path", + "reflection" + ], + "time": "2017-02-02 13:49:58" + }, + { + "name": "symfony/translation", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/symfony/translation.git", + "reference": "5d598faac341f9ac753f327ec62903671d3da8d3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/translation/zipball/5d598faac341f9ac753f327ec62903671d3da8d3", + "reference": "5d598faac341f9ac753f327ec62903671d3da8d3", + "shasum": "" + }, + "require": { + "php": ">=5.5.9", + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/config": "<2.8" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~2.8|~3.0", + "symfony/intl": "~2.8|~3.0", + "symfony/yaml": "~2.8|~3.0" + }, + "suggest": { + "psr/log": "To use logging capability in translator", + "symfony/config": "", + "symfony/yaml": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.3-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Translation\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Translation Component", + "homepage": "https://symfony.com", + "time": "2017-01-21 17:10:26" + }, + { + "name": "symfony/workflow", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/symfony/workflow.git", + "reference": "c5659137631641af4bcc4800f3ed0cc3c3dd0f2a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/workflow/zipball/c5659137631641af4bcc4800f3ed0cc3c3dd0f2a", + "reference": "c5659137631641af4bcc4800f3ed0cc3c3dd0f2a", + "shasum": "" + }, + "require": { + "php": ">=5.5.9", + "symfony/property-access": "~2.3|~3.0" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/event-dispatcher": "~2.1|~3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.3-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Workflow\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Grégoire Pineau", + "email": "lyrixx@lyrixx.info" + } + ], + "description": "Symfony Workflow Component", + "homepage": "http://symfony.com", + "keywords": [ + "petrinet", + "place", + "transition", + "workflow" + ], + "time": "2017-01-21 17:10:26" + } + ], + "packages-dev": [ + { + "name": "doctrine/instantiator", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "68099b02b60bbf3b088ff5cb67bf506770ef9cac" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/68099b02b60bbf3b088ff5cb67bf506770ef9cac", + "reference": "68099b02b60bbf3b088ff5cb67bf506770ef9cac", + "shasum": "" + }, + "require": { + "php": ">=5.3,<8.0-DEV" + }, + "require-dev": { + "athletic/athletic": "~0.1.8", + "ext-pdo": "*", + "ext-phar": "*", + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "~2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "http://ocramius.github.com/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://github.com/doctrine/instantiator", + "keywords": [ + "constructor", + "instantiate" + ], + "time": "2017-01-23 09:23:06" + }, + { + "name": "myclabs/deep-copy", + "version": "1.6.0", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "5a5a9fc8025a08d8919be87d6884d5a92520cefe" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/5a5a9fc8025a08d8919be87d6884d5a92520cefe", + "reference": "5a5a9fc8025a08d8919be87d6884d5a92520cefe", + "shasum": "" + }, + "require": { + "php": ">=5.4.0" + }, + "require-dev": { + "doctrine/collections": "1.*", + "phpunit/phpunit": "~4.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "homepage": "https://github.com/myclabs/DeepCopy", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "time": "2017-01-26T22:05:40+00:00" + }, + { + "name": "phpdocumentor/reflection-common", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/144c307535e82c8fdcaacbcfc1d6d8eeb896687c", + "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c", + "shasum": "" + }, + "require": { + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "^4.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" + } + ], + "description": "Common reflection classes used by phpdocumentor to reflect the code structure", + "homepage": "http://www.phpdoc.org", + "keywords": [ + "FQSEN", + "phpDocumentor", + "phpdoc", + "reflection", + "static analysis" + ], + "time": "2015-12-27 11:43:31" + }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "3.1.1", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/8331b5efe816ae05461b7ca1e721c01b46bafb3e", + "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e", + "shasum": "" + }, + "require": { + "php": ">=5.5", + "phpdocumentor/reflection-common": "^1.0@dev", + "phpdocumentor/type-resolver": "^0.2.0", + "webmozart/assert": "^1.0" + }, + "require-dev": { + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^4.4" + }, + "type": "library", + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "time": "2016-09-30T07:12:33+00:00" + }, + { + "name": "phpdocumentor/type-resolver", + "version": "0.2.1", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb", + "reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb", + "shasum": "" + }, + "require": { + "php": ">=5.5", + "phpdocumentor/reflection-common": "^1.0" + }, + "require-dev": { + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^5.2||^4.8.24" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "time": "2016-11-25T06:54:22+00:00" + }, + { + "name": "phpspec/prophecy", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/phpspec/prophecy.git", + "reference": "6c52c2722f8460122f96f86346600e1077ce22cb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/6c52c2722f8460122f96f86346600e1077ce22cb", + "reference": "6c52c2722f8460122f96f86346600e1077ce22cb", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "php": "^5.3|^7.0", + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2", + "sebastian/comparator": "^1.1", + "sebastian/recursion-context": "^1.0|^2.0" + }, + "require-dev": { + "phpspec/phpspec": "^2.0", + "phpunit/phpunit": "^4.8 || ^5.6.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6.x-dev" + } + }, + "autoload": { + "psr-0": { + "Prophecy\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + }, + { + "name": "Marcello Duarte", + "email": "marcello.duarte@gmail.com" + } + ], + "description": "Highly opinionated mocking framework for PHP 5.3+", + "homepage": "https://github.com/phpspec/prophecy", + "keywords": [ + "Double", + "Dummy", + "fake", + "mock", + "spy", + "stub" + ], + "time": "2016-11-21 14:58:47" + }, + { + "name": "phpunit/php-code-coverage", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "e7d7a4acca58e45bdfd00221563d131cfb04ba96" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/e7d7a4acca58e45bdfd00221563d131cfb04ba96", + "reference": "e7d7a4acca58e45bdfd00221563d131cfb04ba96", + "shasum": "" + }, + "require": { + "php": "^7.0", + "phpunit/php-file-iterator": "^1.3", + "phpunit/php-text-template": "^1.2", + "phpunit/php-token-stream": "^1.4.2", + "sebastian/code-unit-reverse-lookup": "^1.0", + "sebastian/environment": "^2.0", + "sebastian/version": "^2.0" + }, + "require-dev": { + "ext-xdebug": "^2.5", + "phpunit/phpunit": "^6.0" + }, + "suggest": { + "ext-dom": "*", + "ext-xmlwriter": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "time": "2017-02-02 10:35:41" + }, + { + "name": "phpunit/php-file-iterator", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/3cc8f69b3028d0f96a9078e6295d86e9bf019be5", + "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "time": "2016-10-03 07:40:28" + }, + { + "name": "phpunit/php-text-template", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "time": "2015-06-21T13:50:34+00:00" + }, + { + "name": "phpunit/php-timer", + "version": "1.0.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/38e9124049cf1a164f1e4537caf19c99bf1eb260", + "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4|~5" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "time": "2016-05-12T18:03:57+00:00" + }, + { + "name": "phpunit/php-token-stream", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-token-stream.git", + "reference": "3b402f65a4cc90abf6e1104e388b896ce209631b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3b402f65a4cc90abf6e1104e388b896ce209631b", + "reference": "3b402f65a4cc90abf6e1104e388b896ce209631b", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Wrapper around PHP's tokenizer extension.", + "homepage": "https://github.com/sebastianbergmann/php-token-stream/", + "keywords": [ + "tokenizer" + ], + "time": "2016-11-15 14:06:22" + }, + { + "name": "phpunit/phpunit", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "c6f98e536ff91cf9663924e4b354ed9bc7b30dd2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c6f98e536ff91cf9663924e4b354ed9bc7b30dd2", + "reference": "c6f98e536ff91cf9663924e4b354ed9bc7b30dd2", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "myclabs/deep-copy": "^1.3", + "php": "^7.0", + "phpspec/prophecy": "^1.6.2", + "phpunit/php-code-coverage": "^5.0", + "phpunit/php-file-iterator": "^1.4", + "phpunit/php-text-template": "^1.2", + "phpunit/php-timer": "^1.0.6", + "phpunit/phpunit-mock-objects": "^4.0", + "sebastian/comparator": "^1.2.4", + "sebastian/diff": "^1.2", + "sebastian/environment": "^2.0", + "sebastian/exporter": "^2.0", + "sebastian/global-state": "^1.1", + "sebastian/object-enumerator": "^2.0", + "sebastian/resource-operations": "^1.0", + "sebastian/version": "^2.0" + }, + "conflict": { + "phpdocumentor/reflection-docblock": "3.0.2", + "phpunit/dbunit": "<3.0" + }, + "require-dev": { + "ext-pdo": "*" + }, + "suggest": { + "ext-xdebug": "*", + "phpunit/php-invoker": "^1.1" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.1.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "time": "2017-02-10 09:07:31" + }, + { + "name": "phpunit/phpunit-mock-objects", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", + "reference": "d89b9de0a9761552d263d7f5747db7a3053e991d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/d89b9de0a9761552d263d7f5747db7a3053e991d", + "reference": "d89b9de0a9761552d263d7f5747db7a3053e991d", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "php": "^7.0", + "phpunit/php-text-template": "^1.2", + "sebastian/exporter": "^2.0" + }, + "conflict": { + "phpunit/phpunit": "<6.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "suggest": { + "ext-soap": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Mock Object library for PHPUnit", + "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", + "keywords": [ + "mock", + "xunit" + ], + "time": "2017-02-05 15:27:55" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "11606652af09e847cdbbbc3ca17df26b1173a454" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/11606652af09e847cdbbbc3ca17df26b1173a454", + "reference": "11606652af09e847cdbbbc3ca17df26b1173a454", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "require-dev": { + "phpunit/phpunit": "~5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "time": "2016-12-06 20:05:00" + }, + { + "name": "sebastian/comparator", + "version": "1.2.x-dev", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", + "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "sebastian/diff": "~1.2", + "sebastian/exporter": "~1.2 || ~2.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "http://www.github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "time": "2017-01-29 09:50:25" + }, + { + "name": "sebastian/diff", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "d0814318784b7756fb932116acd19ee3b0cbe67a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/d0814318784b7756fb932116acd19ee3b0cbe67a", + "reference": "d0814318784b7756fb932116acd19ee3b0cbe67a", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff" + ], + "time": "2016-10-03 07:45:03" + }, + { + "name": "sebastian/environment", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/5795ffe5dc5b02460c3e34222fee8cbe245d8fac", + "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "http://www.github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "time": "2016-11-26 07:53:53" + }, + { + "name": "sebastian/exporter", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4", + "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "sebastian/recursion-context": "~2.0" + }, + "require-dev": { + "ext-mbstring": "*", + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "http://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "time": "2016-11-19 08:54:04" + }, + { + "name": "sebastian/global-state", + "version": "1.1.x-dev", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "5a2b9ba59e8cf82fd1fdd7efb7d7846fd69ac36d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/5a2b9ba59e8cf82fd1fdd7efb7d7846fd69ac36d", + "reference": "5a2b9ba59e8cf82fd1fdd7efb7d7846fd69ac36d", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.2|~5.0" + }, + "suggest": { + "ext-uopz": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Snapshotting of global state", + "homepage": "http://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ], + "time": "2016-10-03 07:46:22" + }, + { + "name": "sebastian/object-enumerator", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "96f8a3f257b69e8128ad74d3a7fd464bcbaa3b35" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/96f8a3f257b69e8128ad74d3a7fd464bcbaa3b35", + "reference": "96f8a3f257b69e8128ad74d3a7fd464bcbaa3b35", + "shasum": "" + }, + "require": { + "php": ">=5.6", + "sebastian/recursion-context": "~2.0" + }, + "require-dev": { + "phpunit/phpunit": "~5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "time": "2016-11-19 07:35:10" + }, + { + "name": "sebastian/recursion-context", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/2c3ba150cbec723aa057506e73a8d33bdb286c9a", + "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "time": "2016-11-19 07:33:16" + }, + { + "name": "sebastian/resource-operations", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "fadc83f7c41fb2924e542635fea47ae546816ece" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/fadc83f7c41fb2924e542635fea47ae546816ece", + "reference": "fadc83f7c41fb2924e542635fea47ae546816ece", + "shasum": "" + }, + "require": { + "php": ">=5.6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "time": "2016-10-03 07:43:09" + }, + { + "name": "sebastian/version", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "time": "2016-10-03 07:35:21" + }, + { + "name": "webmozart/assert", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/webmozart/assert.git", + "reference": "4a8bf11547e139e77b651365113fc12850c43d9a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozart/assert/zipball/4a8bf11547e139e77b651365113fc12850c43d9a", + "reference": "4a8bf11547e139e77b651365113fc12850c43d9a", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.6", + "sebastian/version": "^1.0.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3-dev" + } + }, + "autoload": { + "psr-4": { + "Webmozart\\Assert\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Assertions to validate method input/output with nice error messages.", + "keywords": [ + "assert", + "check", + "validate" + ], + "time": "2016-11-23 20:04:41" + } + ], + "aliases": [], + "minimum-stability": "dev", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=5.5.9" + }, + "platform-dev": [] +} diff --git a/config/config.php b/config/config.php index 53d8135..7c6fd39 100644 --- a/config/config.php +++ b/config/config.php @@ -2,45 +2,12 @@ return [ 'straight' => [ + 'type' => 'state_machine', 'marking_store' => [ - 'type' => 'property_accessor', - ], - 'supports' => [ - 0 => 'stdClass', - ], - 'places' => [ - 0 => 'a', - 1 => 'b', - 2 => 'c', - 3 => 'd', - ], - 'transitions' => [ - 't1' => [ - 'from' => 'a', - 'to' => 'b', - ], - 't2' => [ - 'from' => 'b', - 'to' => 'c', - ], - 't3' => [ - 'from' => 'c', - 'to' => 'd', - ], - ], - ], - 'round_trip' => [ - 'marking_store' => [ - 'type' => 'property_accessor', - ], - 'supports' => [ - 0 => 'stdClass', - ], - 'places' => [ - 0 => 'a', - 1 => 'b', - 2 => 'c', + 'type' => 'single_state', ], + 'supports' => ['stdClass'], + 'places' => ['a', 'b', 'c'], 'transitions' => [ 't1' => [ 'from' => 'a', @@ -49,160 +16,7 @@ 't2' => [ 'from' => 'b', 'to' => 'c', - ], - 't3' => [ - 'from' => 'c', - 'to' => 'a', - ], - ], - ], - 'or' => [ - 'marking_store' => [ - 'type' => 'property_accessor', - ], - 'supports' => [ - 0 => 'stdClass', - ], - 'places' => [ - 0 => 'a', - 1 => 'b', - 2 => 'c', - 3 => 'd', - ], - 'transitions' => [ - 't1' => [ - 'from' => 'a', - 'to' => 'b', - ], - 't2' => [ - 'from' => 'a', - 'to' => 'c', - ], - 't3' => [ - 'from' => 'b', - 'to' => 'd', - ], - 't4' => [ - 'from' => 'c', - 'to' => 'd', - ], - ], - ], - 'and' => [ - 'marking_store' => [ - 'type' => 'property_accessor', - ], - 'supports' => [ - 0 => 'stdClass', - ], - 'places' => [ - 0 => 'a', - 1 => 'b', - 2 => 'c', - 3 => 'd', - 4 => 'e', - 5 => 'f', - ], - 'transitions' => [ - 't1' => [ - 'from' => 'a', - 'to' => [ - 0 => 'b', - 1 => 'c', - ], - ], - 't2' => [ - 'from' => 'b', - 'to' => 'd', - ], - 't3' => [ - 'from' => 'c', - 'to' => 'e', - ], - 't4' => [ - 'from' => [ - 0 => 'd', - 1 => 'e', - ], - 'to' => 'f', - ], - ], - ], - 'wtf' => [ - 'marking_store' => [ - 'type' => 'property_accessor', - ], - 'supports' => 'stdClass', - 'places' => [ - 0 => 'a', - 1 => 'b', - 2 => 'c', - 3 => 'd', - 4 => 'e', - 5 => 'f', - 6 => 'g', - 7 => 'h', - 8 => 'i', - 9 => 'j', - 10 => 'k', - ], - 'transitions' => [ - 't1' => [ - 'from' => 'a', - 'to' => 'b', - ], - 't2' => [ - 'from' => 'b', - 'to' => 'c', - ], - 't3' => [ - 'from' => 'c', - 'to' => 'd', - ], - 't4' => [ - 'from' => 'b', - 'to' => 'e', - ], - 't5' => [ - 'from' => 'b', - 'to' => 'f', - ], - 't6' => [ - 'from' => [ - 0 => 'c', - 1 => 'd', - ], - 'to' => [ - 0 => 'f', - 1 => 'g', - ], - ], - 't7' => [ - 'from' => 'e', - 'to' => 'h', - ], - 't8' => [ - 'from' => [ - 0 => 'e', - 1 => 'g', - 2 => 'i', - ], - 'to' => 'h', - ], - 't9' => [ - 'from' => [ - 0 => 'f', - 1 => 'g', - ], - 'to' => [ - 0 => 'i', - 1 => 'j', - ], - ], - 't10' => [ - 'from' => 'h', - 'to' => 'k', - ], + ] ], - ], -]; \ No newline at end of file + ] +]; diff --git a/phpunit.xml b/phpunit.xml new file mode 100644 index 0000000..5240048 --- /dev/null +++ b/phpunit.xml @@ -0,0 +1,25 @@ + + + + + ./tests + + + + + ./src + + + diff --git a/src/Picr/LaravelWorkflow/Commands/WorkflowGraphvizDumpCommand.php b/src/LaravelWorkflow/Commands/WorkflowDumpCommand.php similarity index 64% rename from src/Picr/LaravelWorkflow/Commands/WorkflowGraphvizDumpCommand.php rename to src/LaravelWorkflow/Commands/WorkflowDumpCommand.php index a8e2d8b..e762b8f 100644 --- a/src/Picr/LaravelWorkflow/Commands/WorkflowGraphvizDumpCommand.php +++ b/src/LaravelWorkflow/Commands/WorkflowDumpCommand.php @@ -1,25 +1,25 @@ argument('workflow'); $config = Config::get('workflow'); + if (!isset($config[$workflowName])) { - throw new Exception("There is not a workflow called $workflowName configured."); + throw new Exception("Workflow $workflowName is not configured."); } + $className = $config[$workflowName]['supports'][0]; // todo: add option to select single class? $workflow = Workflow::get(new $className, $workflowName); - $property = new ReflectionProperty($workflow, 'definition'); + $property = new \ReflectionProperty(SynfonyWorkflow::class, 'definition'); $property->setAccessible(true); $definition = $property->getValue($workflow); $dumper = new GraphvizDumper(); - if (! $outputType = $this->option('format')) { - $this->output->writeln($dumper->dump($definition)); + $format = $this->option('format'); - return; - } + $dotCommand = "dot -T$format -o $workflowName.$format"; - $process = new Process('dot -T' . $outputType); + $process = new Process($dotCommand); $process->setInput($dumper->dump($definition)); $process->mustRun(); - $output = $process->getOutput(); - file_put_contents($workflowName . '.' . $outputType, $output); - } -} \ No newline at end of file +} diff --git a/src/Picr/LaravelWorkflow/Events/EventDispatcher.php b/src/LaravelWorkflow/Events/EventDispatcher.php similarity index 87% rename from src/Picr/LaravelWorkflow/Events/EventDispatcher.php rename to src/LaravelWorkflow/Events/EventDispatcher.php index a95dbeb..e0affe5 100644 --- a/src/Picr/LaravelWorkflow/Events/EventDispatcher.php +++ b/src/LaravelWorkflow/Events/EventDispatcher.php @@ -1,6 +1,6 @@ publishes([$configPath => config_path('workflow.php')], 'config'); + } + + /** + * Register the application services. + * + * @return void + */ + public function register() + { + $this->commands($this->commands); + + $this->app->singleton( + 'workflow', function ($app) { + return new WorkflowRegistry($app['config']['workflow']); + } + ); + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return ['workflow']; + } +} diff --git a/src/LaravelWorkflow/WorkflowRegistry.php b/src/LaravelWorkflow/WorkflowRegistry.php new file mode 100644 index 0000000..60f6a0a --- /dev/null +++ b/src/LaravelWorkflow/WorkflowRegistry.php @@ -0,0 +1,110 @@ +registry = new Registry(); + $this->config = $config; + + foreach ($this->config as $name => $workflowData) { + $builder = new DefinitionBuilder($workflowData['places']); + + foreach ($workflowData['transitions'] as $transitionName => $transition) { + $builder->addTransition(new Transition($transitionName, $transition['from'], $transition['to'])); + } + + $definition = $builder->build(); + $markingStore = $this->getMakingStoreInstance($workflowData); + $workflow = $this->getWorkflowInstance($name, $workflowData, $definition, $markingStore); + + foreach ($workflowData['supports'] as $supportedClass) { + $this->registry->add($workflow, $supportedClass); + } + } + } + + public function get($subject, $workflowName = null) + { + return $this->registry->get($subject, $workflowName); + } + + public function add(Workflow $workflow, $supportStrategy) + { + return $this->registry->add($workflow, $supportStrategy); + } + + /** + * Return the workflow instance + * + * @param String $name + * @param array $workflowData + * @param Symfony\Component\Workflow\Definition $definition + * @param Symfony\Component\Workflow\MarkingStore\MarkingStoreInterface $makingStore + * @return Symfony\Component\Workflow\Workflow + */ + private function getWorkflowInstance($name, $workflowData, Definition $definition, MarkingStoreInterface $markingStore) + { + $type = isset($workflowData['type']) ? $workflowData['type'] : 'workflow'; + $className = Workflow::class; + + if ($type === 'state_machine') { + $className = StateMachine::class; + } else if (isset($workflowData['class'])) { + $className = $workflowData['class']; + } + + return new $className($definition, $markingStore, new EventDispatcher(), $name); + } + + /** + * Return the making store instance + * + * @param array $makingStoreData + * @return Symfony\Component\Workflow\MarkingStore\MarkingStoreInterface + */ + private function getMakingStoreInstance($workflowData) + { + $makingStoreData = isset($workflowData['marking_store']) ? $workflowData['marking_store'] : []; + $type = isset($makingStoreData['type']) ? $makingStoreData['type'] : 'single_state'; + $className = SingleStateMarkingStore::class; + $arguments = []; + + if ($type === 'multiple_state') { + $className = MultipleStateMarkingStore::class; + } else if (isset($workflowData['class'])) { + $className = $workflowData['class']; + } + + if (isset($makingStoreData['arguments'])) { + $arguments = $makingStoreData['arguments']; + } + + $class = new \ReflectionClass($className); + + return $class->newInstanceArgs($arguments); + } +} diff --git a/src/Picr/LaravelWorkflow/WorkflowServiceProvider.php b/src/Picr/LaravelWorkflow/WorkflowServiceProvider.php deleted file mode 100644 index 1c8fc22..0000000 --- a/src/Picr/LaravelWorkflow/WorkflowServiceProvider.php +++ /dev/null @@ -1,88 +0,0 @@ -publishes([$configPath => config_path('laravel-workflow.php')], 'config'); - } - - /** - * Register the application services. - * - * @return void - */ - public function register() - { - $this->commands($this->commands); - $this->registerWorkflow(); - } - - /** - * Register the Workflow - */ - public function registerWorkflow() - { - $this->app->singleton('workflow', function ($app) { - $registry = new Registry(); - foreach ($app['config']['workflow'] as $name => $workflowData) { - $definition = new Definition($workflowData['places']); - foreach ($workflowData['transitions'] as $transitionName => $transition) { - $definition->addTransition(new Transition($transitionName, $transition['from'], $transition['to'])); - } - - if (isset($workflowData['marking_store']['type'])) { - switch ($workflowData['marking_store']['type']) { - case 'property_accessor': - $markingStore = new PropertyAccessorMarkingStore(); - break; - case 'scalar': - $markingStore = new ScalarMarkingStore(); - break; - default: - throw new Exception("There needs to be a marking store"); - } - } - $workflow = new Workflow($definition, $markingStore, new EventDispatcher(), $name); - - foreach ($workflowData['supports'] as $supportedClass) { - $registry->add($workflow, $supportedClass); - } - } - - return $registry; - }); - } - - /** - * Get the services provided by the provider. - * - * @return array - */ - public function provides() - { - return ['workflow']; - } -} \ No newline at end of file diff --git a/straight.png b/straight.png new file mode 100644 index 0000000000000000000000000000000000000000..18603a7712ad2f696a53745dddfc09fd77cfbe29 GIT binary patch literal 10381 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 [ + 'supports' => ['stdClass'], + 'places' => ['a', 'b', 'c'], + 'transitions' => [ + 't1' => [ + 'from' => 'a', + 'to' => 'b', + ], + 't2' => [ + 'from' => 'b', + 'to' => 'c', + ] + ], + ] +]; + +class Config +{ + public static function get($name) + { + global $config; + + return $config; + } +} + +class Workflow +{ + public static function get($object, $name) + { + global $config; + + $workflowRegistry = new WorkflowRegistry($config); + + return $workflowRegistry->get($object, $name); + } +} + +class WorkflowRegistryTest extends TestCase +{ + public function testWorkflowCommand() + { + $command = Mockery::mock(WorkflowDumpCommand::class) + ->makePartial() + ->shouldReceive('argument') + ->with('workflow') + ->andReturn('straight') + ->shouldReceive('option') + ->with('format') + ->andReturn('png') + ->getMock(); + + $command->handle(); + + $this->assertTrue(file_exists('straight.png')); + } +} diff --git a/tests/WorkflowRegistryTest.php b/tests/WorkflowRegistryTest.php new file mode 100644 index 0000000..7e1a7a7 --- /dev/null +++ b/tests/WorkflowRegistryTest.php @@ -0,0 +1,78 @@ + [ + 'supports' => ['stdClass'], + 'places' => ['a', 'b', 'c'], + 'transitions' => [ + 't1' => [ + 'from' => 'a', + 'to' => 'b', + ], + 't2' => [ + 'from' => 'b', + 'to' => 'c', + ] + ], + ] + ]; + + $registry = new WorkflowRegistry($config); + $object = new stdClass; + $workflow = $registry->get($object); + + $markingProp = new \ReflectionProperty(Workflow::class, 'markingStore'); + $markingProp->setAccessible(true); + + $marking = $markingProp->getValue($workflow); + + $this->assertTrue($workflow instanceof Workflow); + $this->assertTrue($marking instanceof SingleStateMarkingStore); + } + + public function testIfStateMachineIsRegisrter() + { + $config = [ + 'straight' => [ + 'type' => 'state_machine', + 'marking_store' => [ + 'type' => 'multiple_state', + ], + 'supports' => ['stdClass'], + 'places' => ['a', 'b', 'c'], + 'transitions' => [ + 't1' => [ + 'from' => 'a', + 'to' => 'b', + ], + 't2' => [ + 'from' => 'b', + 'to' => 'c', + ] + ], + ] + ]; + + $registry = new WorkflowRegistry($config); + $object = new stdClass; + $workflow = $registry->get($object); + + $markingProp = new \ReflectionProperty(Workflow::class, 'markingStore'); + $markingProp->setAccessible(true); + + $marking = $markingProp->getValue($workflow); + + $this->assertTrue($workflow instanceof StateMachine); + $this->assertTrue($marking instanceof MultipleStateMarkingStore); + } +} From ed6ba6720386ae198eef9e795e8d12100aac87f1 Mon Sep 17 00:00:00 2001 From: Boris KOUMONDJI Date: Sun, 12 Feb 2017 23:00:54 +0100 Subject: [PATCH 02/83] Update composer dependencies --- composer.json | 10 +++++----- composer.lock | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/composer.json b/composer.json index 147a36c..6d3eaae 100644 --- a/composer.json +++ b/composer.json @@ -5,11 +5,11 @@ "license": "MIT", "require": { "php": ">=5.5.9", - "symfony/workflow": "^3.2", - "symfony/process": "^3.2", - "symfony/event-dispatcher": "^3.2", - "mockery/mockery": "^0.9.8", - "illuminate/console": "^5.4" + "symfony/workflow": "~3.2", + "symfony/process": "~3.2", + "symfony/event-dispatcher": "~3.2", + "mockery/mockery": "~0.9", + "illuminate/console": "~5.4" }, "autoload": { "psr-0": { diff --git a/composer.lock b/composer.lock index 103d237..419e4b7 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "041bd3f181b681c0887f42d992ac07db", + "content-hash": "ae534eaf348ced0741aef1a5cc5924d5", "packages": [ { "name": "doctrine/inflector", @@ -560,12 +560,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "84a2c430d9dc835189cbd8739eb14ba94b5f4a07" + "reference": "6a980cb6c9c02f2b5313945de4d5567df2a4ef77" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/84a2c430d9dc835189cbd8739eb14ba94b5f4a07", - "reference": "84a2c430d9dc835189cbd8739eb14ba94b5f4a07", + "url": "https://api.github.com/repos/symfony/debug/zipball/6a980cb6c9c02f2b5313945de4d5567df2a4ef77", + "reference": "6a980cb6c9c02f2b5313945de4d5567df2a4ef77", "shasum": "" }, "require": { @@ -608,7 +608,7 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2017-01-28 02:39:08" + "time": "2017-02-12 19:33:56" }, { "name": "symfony/event-dispatcher", From 2ff6956d8ddc8294131ed7f9f8fdae76ec044750 Mon Sep 17 00:00:00 2001 From: Boris KOUMONDJI Date: Sun, 12 Feb 2017 23:08:45 +0100 Subject: [PATCH 03/83] Update composer dependencies verion --- composer.json | 10 +-- composer.lock | 234 +++++++++++++++++++++++++------------------------- 2 files changed, 122 insertions(+), 122 deletions(-) diff --git a/composer.json b/composer.json index 6d3eaae..bed131d 100644 --- a/composer.json +++ b/composer.json @@ -5,11 +5,10 @@ "license": "MIT", "require": { "php": ">=5.5.9", - "symfony/workflow": "~3.2", - "symfony/process": "~3.2", - "symfony/event-dispatcher": "~3.2", - "mockery/mockery": "~0.9", - "illuminate/console": "~5.4" + "symfony/workflow": "^3.2", + "symfony/process": "^3.2", + "symfony/event-dispatcher": "^3.2", + "illuminate/console": "^5.4" }, "autoload": { "psr-0": { @@ -23,6 +22,7 @@ }, "minimum-stability": "dev", "require-dev": { + "mockery/mockery": "^0.9.8", "phpunit/phpunit": "^6.0" } } diff --git a/composer.lock b/composer.lock index 419e4b7..575410c 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "ae534eaf348ced0741aef1a5cc5924d5", + "content-hash": "ca373a6bf42dd37fb90bda44be64fe15", "packages": [ { "name": "doctrine/inflector", @@ -73,57 +73,6 @@ ], "time": "2016-05-12 17:23:41" }, - { - "name": "hamcrest/hamcrest-php", - "version": "1.2.x-dev", - "source": { - "type": "git", - "url": "https://github.com/hamcrest/hamcrest-php.git", - "reference": "b72949ccf2f640e7de66ff7dd92d83f577ce782e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/hamcrest/hamcrest-php/zipball/b72949ccf2f640e7de66ff7dd92d83f577ce782e", - "reference": "b72949ccf2f640e7de66ff7dd92d83f577ce782e", - "shasum": "" - }, - "require": { - "php": "^5.3|^7.0" - }, - "replace": { - "cordoval/hamcrest-php": "*", - "davedevelopment/hamcrest-php": "*", - "kodova/hamcrest-php": "*" - }, - "require-dev": { - "phpunit/php-file-iterator": "1.3.3", - "phpunit/phpunit": "~4.0", - "satooshi/php-coveralls": "^1.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2-dev" - } - }, - "autoload": { - "classmap": [ - "hamcrest" - ], - "files": [ - "hamcrest/Hamcrest.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD" - ], - "description": "This is the PHP port of Hamcrest Matchers", - "keywords": [ - "test" - ], - "time": "2016-01-19 12:08:55" - }, { "name": "illuminate/console", "version": "dev-master", @@ -273,71 +222,6 @@ "homepage": "https://laravel.com", "time": "2017-02-12 14:42:51" }, - { - "name": "mockery/mockery", - "version": "0.9.x-dev", - "source": { - "type": "git", - "url": "https://github.com/padraic/mockery.git", - "reference": "1e5e2ffdc4d71d7358ed58a6fdd30a4a0c506855" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/padraic/mockery/zipball/1e5e2ffdc4d71d7358ed58a6fdd30a4a0c506855", - "reference": "1e5e2ffdc4d71d7358ed58a6fdd30a4a0c506855", - "shasum": "" - }, - "require": { - "hamcrest/hamcrest-php": "~1.1", - "lib-pcre": ">=7.0", - "php": ">=5.3.2" - }, - "require-dev": { - "phpunit/phpunit": "~4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "0.9.x-dev" - } - }, - "autoload": { - "psr-0": { - "Mockery": "library/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Pádraic Brady", - "email": "padraic.brady@gmail.com", - "homepage": "http://blog.astrumfutura.com" - }, - { - "name": "Dave Marshall", - "email": "dave.marshall@atstsolutions.co.uk", - "homepage": "http://davedevelopment.co.uk" - } - ], - "description": "Mockery is a simple yet flexible PHP mock object framework for use in unit testing with PHPUnit, PHPSpec or any other testing framework. Its core goal is to offer a test double framework with a succinct API capable of clearly defining all possible object operations and interactions using a human readable Domain Specific Language (DSL). Designed as a drop in alternative to PHPUnit's phpunit-mock-objects library, Mockery is easy to integrate with PHPUnit and can operate alongside phpunit-mock-objects without the World ending.", - "homepage": "http://github.com/padraic/mockery", - "keywords": [ - "BDD", - "TDD", - "library", - "mock", - "mock objects", - "mockery", - "stub", - "test", - "test double", - "testing" - ], - "time": "2017-02-09 13:29:38" - }, { "name": "nesbot/carbon", "version": "dev-master", @@ -1146,6 +1030,122 @@ ], "time": "2017-01-23 09:23:06" }, + { + "name": "hamcrest/hamcrest-php", + "version": "1.2.x-dev", + "source": { + "type": "git", + "url": "https://github.com/hamcrest/hamcrest-php.git", + "reference": "b72949ccf2f640e7de66ff7dd92d83f577ce782e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/hamcrest/hamcrest-php/zipball/b72949ccf2f640e7de66ff7dd92d83f577ce782e", + "reference": "b72949ccf2f640e7de66ff7dd92d83f577ce782e", + "shasum": "" + }, + "require": { + "php": "^5.3|^7.0" + }, + "replace": { + "cordoval/hamcrest-php": "*", + "davedevelopment/hamcrest-php": "*", + "kodova/hamcrest-php": "*" + }, + "require-dev": { + "phpunit/php-file-iterator": "1.3.3", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "^1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2-dev" + } + }, + "autoload": { + "classmap": [ + "hamcrest" + ], + "files": [ + "hamcrest/Hamcrest.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD" + ], + "description": "This is the PHP port of Hamcrest Matchers", + "keywords": [ + "test" + ], + "time": "2016-01-19 12:08:55" + }, + { + "name": "mockery/mockery", + "version": "0.9.x-dev", + "source": { + "type": "git", + "url": "https://github.com/padraic/mockery.git", + "reference": "1e5e2ffdc4d71d7358ed58a6fdd30a4a0c506855" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/padraic/mockery/zipball/1e5e2ffdc4d71d7358ed58a6fdd30a4a0c506855", + "reference": "1e5e2ffdc4d71d7358ed58a6fdd30a4a0c506855", + "shasum": "" + }, + "require": { + "hamcrest/hamcrest-php": "~1.1", + "lib-pcre": ">=7.0", + "php": ">=5.3.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.9.x-dev" + } + }, + "autoload": { + "psr-0": { + "Mockery": "library/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Pádraic Brady", + "email": "padraic.brady@gmail.com", + "homepage": "http://blog.astrumfutura.com" + }, + { + "name": "Dave Marshall", + "email": "dave.marshall@atstsolutions.co.uk", + "homepage": "http://davedevelopment.co.uk" + } + ], + "description": "Mockery is a simple yet flexible PHP mock object framework for use in unit testing with PHPUnit, PHPSpec or any other testing framework. Its core goal is to offer a test double framework with a succinct API capable of clearly defining all possible object operations and interactions using a human readable Domain Specific Language (DSL). Designed as a drop in alternative to PHPUnit's phpunit-mock-objects library, Mockery is easy to integrate with PHPUnit and can operate alongside phpunit-mock-objects without the World ending.", + "homepage": "http://github.com/padraic/mockery", + "keywords": [ + "BDD", + "TDD", + "library", + "mock", + "mock objects", + "mockery", + "stub", + "test", + "test double", + "testing" + ], + "time": "2017-02-09 13:29:38" + }, { "name": "myclabs/deep-copy", "version": "1.6.0", From e20e4688fef57a2c26eeb20dcb3c54b6563ddc07 Mon Sep 17 00:00:00 2001 From: Boris KOUMONDJI Date: Sun, 12 Feb 2017 23:23:20 +0100 Subject: [PATCH 04/83] Update composer dependencies --- composer.json | 2 +- composer.lock | 80 ++++++++++++++++++++++++--------------------------- 2 files changed, 38 insertions(+), 44 deletions(-) diff --git a/composer.json b/composer.json index bed131d..73e229c 100644 --- a/composer.json +++ b/composer.json @@ -8,7 +8,7 @@ "symfony/workflow": "^3.2", "symfony/process": "^3.2", "symfony/event-dispatcher": "^3.2", - "illuminate/console": "^5.4" + "illuminate/console": "5.3.*" }, "autoload": { "psr-0": { diff --git a/composer.lock b/composer.lock index 575410c..0654fcb 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "ca373a6bf42dd37fb90bda44be64fe15", + "content-hash": "18765262ab0b975abe8405a7b2f69fc3", "packages": [ { "name": "doctrine/inflector", @@ -75,34 +75,34 @@ }, { "name": "illuminate/console", - "version": "dev-master", + "version": "5.3.x-dev", "source": { "type": "git", "url": "https://github.com/illuminate/console.git", - "reference": "6d85ccd08b6337eb7275f1d4d1e70589d0b4af6c" + "reference": "92e04079327e9634053b06d5003a00906be6f966" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/console/zipball/6d85ccd08b6337eb7275f1d4d1e70589d0b4af6c", - "reference": "6d85ccd08b6337eb7275f1d4d1e70589d0b4af6c", + "url": "https://api.github.com/repos/illuminate/console/zipball/92e04079327e9634053b06d5003a00906be6f966", + "reference": "92e04079327e9634053b06d5003a00906be6f966", "shasum": "" }, "require": { - "illuminate/contracts": "5.5.*", - "illuminate/support": "5.5.*", + "illuminate/contracts": "5.3.*", + "illuminate/support": "5.3.*", "nesbot/carbon": "~1.20", - "php": ">=7.0", - "symfony/console": "~3.2" + "php": ">=5.6.4", + "symfony/console": "3.1.*" }, "suggest": { - "guzzlehttp/guzzle": "Required to use the ping methods on schedules (~6.0).", + "guzzlehttp/guzzle": "Required to use the ping methods on schedules (~5.3|~6.0).", "mtdowling/cron-expression": "Required to use scheduling component (~1.0).", - "symfony/process": "Required to use scheduling component (~3.2)." + "symfony/process": "Required to use scheduling component (3.1.*)." }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.5-dev" + "dev-master": "5.3-dev" } }, "autoload": { @@ -122,29 +122,29 @@ ], "description": "The Illuminate Console package.", "homepage": "https://laravel.com", - "time": "2017-01-30 22:05:16" + "time": "2017-01-06 14:26:42" }, { "name": "illuminate/contracts", - "version": "dev-master", + "version": "5.3.x-dev", "source": { "type": "git", "url": "https://github.com/illuminate/contracts.git", - "reference": "981b767f2eec48664ed0f7207a372ddf3c1ec5fb" + "reference": "ebed2e6d1203d7fad2db7184e7a6f18d636bca8d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/contracts/zipball/981b767f2eec48664ed0f7207a372ddf3c1ec5fb", - "reference": "981b767f2eec48664ed0f7207a372ddf3c1ec5fb", + "url": "https://api.github.com/repos/illuminate/contracts/zipball/ebed2e6d1203d7fad2db7184e7a6f18d636bca8d", + "reference": "ebed2e6d1203d7fad2db7184e7a6f18d636bca8d", "shasum": "" }, "require": { - "php": ">=7.0" + "php": ">=5.6.4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.5-dev" + "dev-master": "5.3-dev" } }, "autoload": { @@ -164,40 +164,41 @@ ], "description": "The Illuminate Contracts package.", "homepage": "https://laravel.com", - "time": "2017-02-10 21:32:45" + "time": "2016-12-23 01:26:32" }, { "name": "illuminate/support", - "version": "dev-master", + "version": "5.3.x-dev", "source": { "type": "git", "url": "https://github.com/illuminate/support.git", - "reference": "1ea50a4359bc346ad3f9a804ee43ba023fccd27c" + "reference": "18c5e857f2ee5e2ac61221b6ff444d309d170bf9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/support/zipball/1ea50a4359bc346ad3f9a804ee43ba023fccd27c", - "reference": "1ea50a4359bc346ad3f9a804ee43ba023fccd27c", + "url": "https://api.github.com/repos/illuminate/support/zipball/18c5e857f2ee5e2ac61221b6ff444d309d170bf9", + "reference": "18c5e857f2ee5e2ac61221b6ff444d309d170bf9", "shasum": "" }, "require": { "doctrine/inflector": "~1.0", "ext-mbstring": "*", - "illuminate/contracts": "5.5.*", - "php": ">=7.0" + "illuminate/contracts": "5.3.*", + "paragonie/random_compat": "~1.4|~2.0", + "php": ">=5.6.4" }, "replace": { "tightenco/collect": "self.version" }, "suggest": { "illuminate/filesystem": "Required to use the composer class (5.2.*).", - "symfony/process": "Required to use the composer class (~3.2).", - "symfony/var-dumper": "Required to use the dd function (~3.2)." + "symfony/process": "Required to use the composer class (3.1.*).", + "symfony/var-dumper": "Required to use the dd function (3.1.*)." }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.5-dev" + "dev-master": "5.3-dev" } }, "autoload": { @@ -220,7 +221,7 @@ ], "description": "The Illuminate Support package.", "homepage": "https://laravel.com", - "time": "2017-02-12 14:42:51" + "time": "2016-12-28 19:33:33" }, { "name": "nesbot/carbon", @@ -372,16 +373,16 @@ }, { "name": "symfony/console", - "version": "dev-master", + "version": "3.1.x-dev", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "28698ac32c2694d4a3de8b17bf02fab2b7598ce0" + "reference": "047f16485d68c083bd5d9b73ff16f9cb9c1a9f52" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/28698ac32c2694d4a3de8b17bf02fab2b7598ce0", - "reference": "28698ac32c2694d4a3de8b17bf02fab2b7598ce0", + "url": "https://api.github.com/repos/symfony/console/zipball/047f16485d68c083bd5d9b73ff16f9cb9c1a9f52", + "reference": "047f16485d68c083bd5d9b73ff16f9cb9c1a9f52", "shasum": "" }, "require": { @@ -389,27 +390,20 @@ "symfony/debug": "~2.8|~3.0", "symfony/polyfill-mbstring": "~1.0" }, - "conflict": { - "symfony/dependency-injection": "<3.3" - }, "require-dev": { "psr/log": "~1.0", - "symfony/dependency-injection": "~3.3", "symfony/event-dispatcher": "~2.8|~3.0", - "symfony/filesystem": "~2.8|~3.0", - "symfony/http-kernel": "~2.8|~3.0", "symfony/process": "~2.8|~3.0" }, "suggest": { "psr/log": "For using the console logger", "symfony/event-dispatcher": "", - "symfony/filesystem": "", "symfony/process": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.1-dev" } }, "autoload": { @@ -436,7 +430,7 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2017-02-06 12:04:42" + "time": "2017-01-08 20:43:43" }, { "name": "symfony/debug", From 8e383c2230e35dad737ebe9c89b0e7cf8a012687 Mon Sep 17 00:00:00 2001 From: Boris KOUMONDJI Date: Sun, 12 Feb 2017 23:23:36 +0100 Subject: [PATCH 05/83] Remove test image --- straight.png | Bin 10381 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 straight.png diff --git a/straight.png b/straight.png deleted file mode 100644 index 18603a7712ad2f696a53745dddfc09fd77cfbe29..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 10381 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 Date: Sun, 12 Feb 2017 23:31:02 +0100 Subject: [PATCH 06/83] Update composer dependencies --- composer.json | 6 +++--- composer.lock | 43 ++++++++++++++++++++----------------------- 2 files changed, 23 insertions(+), 26 deletions(-) diff --git a/composer.json b/composer.json index 73e229c..efc0352 100644 --- a/composer.json +++ b/composer.json @@ -5,9 +5,9 @@ "license": "MIT", "require": { "php": ">=5.5.9", - "symfony/workflow": "^3.2", - "symfony/process": "^3.2", - "symfony/event-dispatcher": "^3.2", + "symfony/workflow": "3.2.*", + "symfony/process": "3.1.*", + "symfony/event-dispatcher": "3.1.*", "illuminate/console": "5.3.*" }, "autoload": { diff --git a/composer.lock b/composer.lock index 0654fcb..d5ef84f 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "18765262ab0b975abe8405a7b2f69fc3", + "content-hash": "3b706b3b30ff79d3663431ceae41cfc8", "packages": [ { "name": "doctrine/inflector", @@ -490,28 +490,25 @@ }, { "name": "symfony/event-dispatcher", - "version": "dev-master", + "version": "3.1.x-dev", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "48e343e59e7c7f7cb6171b919082fb4a18df89a6" + "reference": "652fe5441bd5699654662e11defa73e779eacca1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/48e343e59e7c7f7cb6171b919082fb4a18df89a6", - "reference": "48e343e59e7c7f7cb6171b919082fb4a18df89a6", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/652fe5441bd5699654662e11defa73e779eacca1", + "reference": "652fe5441bd5699654662e11defa73e779eacca1", "shasum": "" }, "require": { "php": ">=5.5.9" }, - "conflict": { - "symfony/dependency-injection": "<3.3" - }, "require-dev": { "psr/log": "~1.0", "symfony/config": "~2.8|~3.0", - "symfony/dependency-injection": "~3.3", + "symfony/dependency-injection": "~2.8|~3.0", "symfony/expression-language": "~2.8|~3.0", "symfony/stopwatch": "~2.8|~3.0" }, @@ -522,7 +519,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.1-dev" } }, "autoload": { @@ -549,7 +546,7 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2017-02-02 13:15:15" + "time": "2017-01-02 20:31:54" }, { "name": "symfony/inflector", @@ -728,16 +725,16 @@ }, { "name": "symfony/process", - "version": "dev-master", + "version": "3.1.x-dev", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "37d005254947477f31d6878996b9adcafb2d3c44" + "reference": "2605753c5f8c531623d24d002825ebb1d6a22248" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/37d005254947477f31d6878996b9adcafb2d3c44", - "reference": "37d005254947477f31d6878996b9adcafb2d3c44", + "url": "https://api.github.com/repos/symfony/process/zipball/2605753c5f8c531623d24d002825ebb1d6a22248", + "reference": "2605753c5f8c531623d24d002825ebb1d6a22248", "shasum": "" }, "require": { @@ -746,7 +743,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.1-dev" } }, "autoload": { @@ -773,7 +770,7 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2017-02-08 15:45:40" + "time": "2017-01-21 17:13:55" }, { "name": "symfony/property-access", @@ -909,16 +906,16 @@ }, { "name": "symfony/workflow", - "version": "dev-master", + "version": "3.2.x-dev", "source": { "type": "git", "url": "https://github.com/symfony/workflow.git", - "reference": "c5659137631641af4bcc4800f3ed0cc3c3dd0f2a" + "reference": "9d62c42951f25b184de488d21cc3ee6cc48a8214" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/workflow/zipball/c5659137631641af4bcc4800f3ed0cc3c3dd0f2a", - "reference": "c5659137631641af4bcc4800f3ed0cc3c3dd0f2a", + "url": "https://api.github.com/repos/symfony/workflow/zipball/9d62c42951f25b184de488d21cc3ee6cc48a8214", + "reference": "9d62c42951f25b184de488d21cc3ee6cc48a8214", "shasum": "" }, "require": { @@ -932,7 +929,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -966,7 +963,7 @@ "transition", "workflow" ], - "time": "2017-01-21 17:10:26" + "time": "2017-01-18 05:35:58" } ], "packages-dev": [ From 818a03662401448fa1428c9ebebd546dcb13a6b3 Mon Sep 17 00:00:00 2001 From: Boris KOUMONDJI Date: Sun, 12 Feb 2017 23:58:10 +0100 Subject: [PATCH 07/83] Update composer dependencies --- composer.json | 6 +++--- composer.lock | 43 +++++++++++++++++++++++-------------------- 2 files changed, 26 insertions(+), 23 deletions(-) diff --git a/composer.json b/composer.json index efc0352..7ae1811 100644 --- a/composer.json +++ b/composer.json @@ -5,9 +5,9 @@ "license": "MIT", "require": { "php": ">=5.5.9", - "symfony/workflow": "3.2.*", - "symfony/process": "3.1.*", - "symfony/event-dispatcher": "3.1.*", + "symfony/workflow": "^3.2", + "symfony/process": "^3.1", + "symfony/event-dispatcher": "^3.1", "illuminate/console": "5.3.*" }, "autoload": { diff --git a/composer.lock b/composer.lock index d5ef84f..7a6fe16 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "3b706b3b30ff79d3663431ceae41cfc8", + "content-hash": "77883809938f7795bb836b1de06cecfa", "packages": [ { "name": "doctrine/inflector", @@ -490,25 +490,28 @@ }, { "name": "symfony/event-dispatcher", - "version": "3.1.x-dev", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "652fe5441bd5699654662e11defa73e779eacca1" + "reference": "48e343e59e7c7f7cb6171b919082fb4a18df89a6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/652fe5441bd5699654662e11defa73e779eacca1", - "reference": "652fe5441bd5699654662e11defa73e779eacca1", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/48e343e59e7c7f7cb6171b919082fb4a18df89a6", + "reference": "48e343e59e7c7f7cb6171b919082fb4a18df89a6", "shasum": "" }, "require": { "php": ">=5.5.9" }, + "conflict": { + "symfony/dependency-injection": "<3.3" + }, "require-dev": { "psr/log": "~1.0", "symfony/config": "~2.8|~3.0", - "symfony/dependency-injection": "~2.8|~3.0", + "symfony/dependency-injection": "~3.3", "symfony/expression-language": "~2.8|~3.0", "symfony/stopwatch": "~2.8|~3.0" }, @@ -519,7 +522,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "3.3-dev" } }, "autoload": { @@ -546,7 +549,7 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2017-01-02 20:31:54" + "time": "2017-02-02 13:15:15" }, { "name": "symfony/inflector", @@ -725,16 +728,16 @@ }, { "name": "symfony/process", - "version": "3.1.x-dev", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "2605753c5f8c531623d24d002825ebb1d6a22248" + "reference": "37d005254947477f31d6878996b9adcafb2d3c44" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/2605753c5f8c531623d24d002825ebb1d6a22248", - "reference": "2605753c5f8c531623d24d002825ebb1d6a22248", + "url": "https://api.github.com/repos/symfony/process/zipball/37d005254947477f31d6878996b9adcafb2d3c44", + "reference": "37d005254947477f31d6878996b9adcafb2d3c44", "shasum": "" }, "require": { @@ -743,7 +746,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "3.3-dev" } }, "autoload": { @@ -770,7 +773,7 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2017-01-21 17:13:55" + "time": "2017-02-08 15:45:40" }, { "name": "symfony/property-access", @@ -906,16 +909,16 @@ }, { "name": "symfony/workflow", - "version": "3.2.x-dev", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/symfony/workflow.git", - "reference": "9d62c42951f25b184de488d21cc3ee6cc48a8214" + "reference": "c5659137631641af4bcc4800f3ed0cc3c3dd0f2a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/workflow/zipball/9d62c42951f25b184de488d21cc3ee6cc48a8214", - "reference": "9d62c42951f25b184de488d21cc3ee6cc48a8214", + "url": "https://api.github.com/repos/symfony/workflow/zipball/c5659137631641af4bcc4800f3ed0cc3c3dd0f2a", + "reference": "c5659137631641af4bcc4800f3ed0cc3c3dd0f2a", "shasum": "" }, "require": { @@ -929,7 +932,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2-dev" + "dev-master": "3.3-dev" } }, "autoload": { @@ -963,7 +966,7 @@ "transition", "workflow" ], - "time": "2017-01-18 05:35:58" + "time": "2017-01-21 17:10:26" } ], "packages-dev": [ From a900d8616e49110850446538e5c89b0ea5133fb0 Mon Sep 17 00:00:00 2001 From: Boris KOUMONDJI Date: Mon, 13 Feb 2017 00:12:44 +0100 Subject: [PATCH 08/83] User Brexis\LaravelWorkflow as namespace --- .gitignore | 15 +-------------- README.md | 4 ++-- composer.json | 2 +- .../Commands/WorkflowDumpCommand.php | 2 +- .../LaravelWorkflow/Events/EventDispatcher.php | 2 +- .../LaravelWorkflow/Facades/WorkflowFacade.php | 2 +- .../LaravelWorkflow/ServiceProvider.php | 4 ++-- .../LaravelWorkflow/WorkflowRegistry.php | 4 ++-- tests/WorkflowDumpCommandTest.php | 4 ++-- tests/WorkflowRegistryTest.php | 2 +- 10 files changed, 14 insertions(+), 27 deletions(-) rename src/{ => Brexis}/LaravelWorkflow/Commands/WorkflowDumpCommand.php (97%) rename src/{ => Brexis}/LaravelWorkflow/Events/EventDispatcher.php (96%) rename src/{ => Brexis}/LaravelWorkflow/Facades/WorkflowFacade.php (80%) rename src/{ => Brexis}/LaravelWorkflow/ServiceProvider.php (90%) rename src/{ => Brexis}/LaravelWorkflow/WorkflowRegistry.php (97%) diff --git a/.gitignore b/.gitignore index 1cd717b..69119a8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,15 +1,2 @@ vendor/ -node_modules/ - -# Laravel 4 specific -bootstrap/compiled.php -app/storage/ - -# Laravel 5 & Lumen specific -bootstrap/cache/ -.env.*.php -.env.php -.env - -# Rocketeer PHP task runner and deployment package. https://github.com/rocketeers/rocketeer -.rocketeer/ +straight.png diff --git a/README.md b/README.md index 3e6d4f5..dad281e 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Add a ServiceProvider to your providers array in `config/app.php`: ```php 'providers' => [ ... - 'LaravelWorkflow\ServiceProvider', + 'Brexis\LaravelWorkflow\ServiceProvider', ] ``` @@ -21,7 +21,7 @@ Add a ServiceProvider to your providers array in `config/app.php`: Add the `Workflow` facade to your facades array: ```php - 'Workflow' => 'LaravelWorkflow\Facades\WorkflowFacade', + 'Workflow' => 'Brexis\LaravelWorkflow\Facades\WorkflowFacade', ``` diff --git a/composer.json b/composer.json index 7ae1811..76ea8d6 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ }, "autoload": { "psr-0": { - "LaravelWorkflow": "src/" + "Brexis\\LaravelWorkflow": "src/" } }, "extra": { diff --git a/src/LaravelWorkflow/Commands/WorkflowDumpCommand.php b/src/Brexis/LaravelWorkflow/Commands/WorkflowDumpCommand.php similarity index 97% rename from src/LaravelWorkflow/Commands/WorkflowDumpCommand.php rename to src/Brexis/LaravelWorkflow/Commands/WorkflowDumpCommand.php index e762b8f..c59185f 100644 --- a/src/LaravelWorkflow/Commands/WorkflowDumpCommand.php +++ b/src/Brexis/LaravelWorkflow/Commands/WorkflowDumpCommand.php @@ -1,6 +1,6 @@ [ diff --git a/tests/WorkflowRegistryTest.php b/tests/WorkflowRegistryTest.php index 7e1a7a7..875df65 100644 --- a/tests/WorkflowRegistryTest.php +++ b/tests/WorkflowRegistryTest.php @@ -1,6 +1,6 @@ Date: Mon, 13 Feb 2017 00:36:14 +0100 Subject: [PATCH 09/83] Update composer namespace --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 76ea8d6..b7b3adc 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ }, "autoload": { "psr-0": { - "Brexis\\LaravelWorkflow": "src/" + "Brexis\\LaravelWorkflow\\": "src/" } }, "extra": { From 94490feb8e1548c6b363a82dc6da89de8a34a2bc Mon Sep 17 00:00:00 2001 From: Boris KOUMONDJI Date: Mon, 13 Feb 2017 00:37:12 +0100 Subject: [PATCH 10/83] Use ::class annotation in readme file --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index dad281e..da12881 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Add a ServiceProvider to your providers array in `config/app.php`: ```php 'providers' => [ ... - 'Brexis\LaravelWorkflow\ServiceProvider', + Brexis\LaravelWorkflow\ServiceProvider::class, ] ``` @@ -21,7 +21,8 @@ Add a ServiceProvider to your providers array in `config/app.php`: Add the `Workflow` facade to your facades array: ```php - 'Workflow' => 'Brexis\LaravelWorkflow\Facades\WorkflowFacade', + ... + 'Workflow' => Brexis\LaravelWorkflow\Facades\WorkflowFacade::class, ``` From 2a50034529f1dbdd2ca9be41a0c11694687aedfe Mon Sep 17 00:00:00 2001 From: Boris KOUMONDJI Date: Mon, 13 Feb 2017 00:53:38 +0100 Subject: [PATCH 11/83] Change package namespace --- composer.json | 2 +- phpunit.xml | 11 ++--------- .../Commands/WorkflowDumpCommand.php | 0 .../LaravelWorkflow => }/Events/EventDispatcher.php | 0 .../LaravelWorkflow => }/Facades/WorkflowFacade.php | 0 src/{Brexis/LaravelWorkflow => }/ServiceProvider.php | 0 src/{Brexis/LaravelWorkflow => }/WorkflowRegistry.php | 0 7 files changed, 3 insertions(+), 10 deletions(-) rename src/{Brexis/LaravelWorkflow => }/Commands/WorkflowDumpCommand.php (100%) rename src/{Brexis/LaravelWorkflow => }/Events/EventDispatcher.php (100%) rename src/{Brexis/LaravelWorkflow => }/Facades/WorkflowFacade.php (100%) rename src/{Brexis/LaravelWorkflow => }/ServiceProvider.php (100%) rename src/{Brexis/LaravelWorkflow => }/WorkflowRegistry.php (100%) diff --git a/composer.json b/composer.json index b7b3adc..95620fc 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ "illuminate/console": "5.3.*" }, "autoload": { - "psr-0": { + "psr-4": { "Brexis\\LaravelWorkflow\\": "src/" } }, diff --git a/phpunit.xml b/phpunit.xml index 5240048..9cb3cb2 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -2,24 +2,17 @@ + syntaxCheck="false"> ./tests - - - ./src - - diff --git a/src/Brexis/LaravelWorkflow/Commands/WorkflowDumpCommand.php b/src/Commands/WorkflowDumpCommand.php similarity index 100% rename from src/Brexis/LaravelWorkflow/Commands/WorkflowDumpCommand.php rename to src/Commands/WorkflowDumpCommand.php diff --git a/src/Brexis/LaravelWorkflow/Events/EventDispatcher.php b/src/Events/EventDispatcher.php similarity index 100% rename from src/Brexis/LaravelWorkflow/Events/EventDispatcher.php rename to src/Events/EventDispatcher.php diff --git a/src/Brexis/LaravelWorkflow/Facades/WorkflowFacade.php b/src/Facades/WorkflowFacade.php similarity index 100% rename from src/Brexis/LaravelWorkflow/Facades/WorkflowFacade.php rename to src/Facades/WorkflowFacade.php diff --git a/src/Brexis/LaravelWorkflow/ServiceProvider.php b/src/ServiceProvider.php similarity index 100% rename from src/Brexis/LaravelWorkflow/ServiceProvider.php rename to src/ServiceProvider.php diff --git a/src/Brexis/LaravelWorkflow/WorkflowRegistry.php b/src/WorkflowRegistry.php similarity index 100% rename from src/Brexis/LaravelWorkflow/WorkflowRegistry.php rename to src/WorkflowRegistry.php From 68ed3a7a4c90a97c17366a37e0eca4f3ad0e2e17 Mon Sep 17 00:00:00 2001 From: Boris KOUMONDJI Date: Mon, 13 Feb 2017 01:09:31 +0100 Subject: [PATCH 12/83] Fix conflict ServiceProvider --- README.md | 2 +- composer.json | 3 +- composer.lock | 80 ++++++++++--------- ...ovider.php => WorkflowServiceProvider.php} | 3 +- 4 files changed, 48 insertions(+), 40 deletions(-) rename src/{ServiceProvider.php => WorkflowServiceProvider.php} (90%) diff --git a/README.md b/README.md index da12881..639f0e9 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Add a ServiceProvider to your providers array in `config/app.php`: ```php 'providers' => [ ... - Brexis\LaravelWorkflow\ServiceProvider::class, + Brexis\LaravelWorkflow\WorkflowServiceProvider::class, ] ``` diff --git a/composer.json b/composer.json index 95620fc..f577385 100644 --- a/composer.json +++ b/composer.json @@ -8,7 +8,8 @@ "symfony/workflow": "^3.2", "symfony/process": "^3.1", "symfony/event-dispatcher": "^3.1", - "illuminate/console": "5.3.*" + "illuminate/console": "^5.3", + "illuminate/support": "^5.3" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index 7a6fe16..bc8f68c 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "77883809938f7795bb836b1de06cecfa", + "content-hash": "c5dea795dd6604bf23588d75453e8059", "packages": [ { "name": "doctrine/inflector", @@ -75,34 +75,34 @@ }, { "name": "illuminate/console", - "version": "5.3.x-dev", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/illuminate/console.git", - "reference": "92e04079327e9634053b06d5003a00906be6f966" + "reference": "6d85ccd08b6337eb7275f1d4d1e70589d0b4af6c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/console/zipball/92e04079327e9634053b06d5003a00906be6f966", - "reference": "92e04079327e9634053b06d5003a00906be6f966", + "url": "https://api.github.com/repos/illuminate/console/zipball/6d85ccd08b6337eb7275f1d4d1e70589d0b4af6c", + "reference": "6d85ccd08b6337eb7275f1d4d1e70589d0b4af6c", "shasum": "" }, "require": { - "illuminate/contracts": "5.3.*", - "illuminate/support": "5.3.*", + "illuminate/contracts": "5.5.*", + "illuminate/support": "5.5.*", "nesbot/carbon": "~1.20", - "php": ">=5.6.4", - "symfony/console": "3.1.*" + "php": ">=7.0", + "symfony/console": "~3.2" }, "suggest": { - "guzzlehttp/guzzle": "Required to use the ping methods on schedules (~5.3|~6.0).", + "guzzlehttp/guzzle": "Required to use the ping methods on schedules (~6.0).", "mtdowling/cron-expression": "Required to use scheduling component (~1.0).", - "symfony/process": "Required to use scheduling component (3.1.*)." + "symfony/process": "Required to use scheduling component (~3.2)." }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.3-dev" + "dev-master": "5.5-dev" } }, "autoload": { @@ -122,29 +122,29 @@ ], "description": "The Illuminate Console package.", "homepage": "https://laravel.com", - "time": "2017-01-06 14:26:42" + "time": "2017-01-30 22:05:16" }, { "name": "illuminate/contracts", - "version": "5.3.x-dev", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/illuminate/contracts.git", - "reference": "ebed2e6d1203d7fad2db7184e7a6f18d636bca8d" + "reference": "981b767f2eec48664ed0f7207a372ddf3c1ec5fb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/contracts/zipball/ebed2e6d1203d7fad2db7184e7a6f18d636bca8d", - "reference": "ebed2e6d1203d7fad2db7184e7a6f18d636bca8d", + "url": "https://api.github.com/repos/illuminate/contracts/zipball/981b767f2eec48664ed0f7207a372ddf3c1ec5fb", + "reference": "981b767f2eec48664ed0f7207a372ddf3c1ec5fb", "shasum": "" }, "require": { - "php": ">=5.6.4" + "php": ">=7.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.3-dev" + "dev-master": "5.5-dev" } }, "autoload": { @@ -164,41 +164,40 @@ ], "description": "The Illuminate Contracts package.", "homepage": "https://laravel.com", - "time": "2016-12-23 01:26:32" + "time": "2017-02-10 21:32:45" }, { "name": "illuminate/support", - "version": "5.3.x-dev", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/illuminate/support.git", - "reference": "18c5e857f2ee5e2ac61221b6ff444d309d170bf9" + "reference": "1ea50a4359bc346ad3f9a804ee43ba023fccd27c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/support/zipball/18c5e857f2ee5e2ac61221b6ff444d309d170bf9", - "reference": "18c5e857f2ee5e2ac61221b6ff444d309d170bf9", + "url": "https://api.github.com/repos/illuminate/support/zipball/1ea50a4359bc346ad3f9a804ee43ba023fccd27c", + "reference": "1ea50a4359bc346ad3f9a804ee43ba023fccd27c", "shasum": "" }, "require": { "doctrine/inflector": "~1.0", "ext-mbstring": "*", - "illuminate/contracts": "5.3.*", - "paragonie/random_compat": "~1.4|~2.0", - "php": ">=5.6.4" + "illuminate/contracts": "5.5.*", + "php": ">=7.0" }, "replace": { "tightenco/collect": "self.version" }, "suggest": { "illuminate/filesystem": "Required to use the composer class (5.2.*).", - "symfony/process": "Required to use the composer class (3.1.*).", - "symfony/var-dumper": "Required to use the dd function (3.1.*)." + "symfony/process": "Required to use the composer class (~3.2).", + "symfony/var-dumper": "Required to use the dd function (~3.2)." }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.3-dev" + "dev-master": "5.5-dev" } }, "autoload": { @@ -221,7 +220,7 @@ ], "description": "The Illuminate Support package.", "homepage": "https://laravel.com", - "time": "2016-12-28 19:33:33" + "time": "2017-02-12 14:42:51" }, { "name": "nesbot/carbon", @@ -373,16 +372,16 @@ }, { "name": "symfony/console", - "version": "3.1.x-dev", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "047f16485d68c083bd5d9b73ff16f9cb9c1a9f52" + "reference": "28698ac32c2694d4a3de8b17bf02fab2b7598ce0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/047f16485d68c083bd5d9b73ff16f9cb9c1a9f52", - "reference": "047f16485d68c083bd5d9b73ff16f9cb9c1a9f52", + "url": "https://api.github.com/repos/symfony/console/zipball/28698ac32c2694d4a3de8b17bf02fab2b7598ce0", + "reference": "28698ac32c2694d4a3de8b17bf02fab2b7598ce0", "shasum": "" }, "require": { @@ -390,20 +389,27 @@ "symfony/debug": "~2.8|~3.0", "symfony/polyfill-mbstring": "~1.0" }, + "conflict": { + "symfony/dependency-injection": "<3.3" + }, "require-dev": { "psr/log": "~1.0", + "symfony/dependency-injection": "~3.3", "symfony/event-dispatcher": "~2.8|~3.0", + "symfony/filesystem": "~2.8|~3.0", + "symfony/http-kernel": "~2.8|~3.0", "symfony/process": "~2.8|~3.0" }, "suggest": { "psr/log": "For using the console logger", "symfony/event-dispatcher": "", + "symfony/filesystem": "", "symfony/process": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "3.3-dev" } }, "autoload": { @@ -430,7 +436,7 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2017-01-08 20:43:43" + "time": "2017-02-06 12:04:42" }, { "name": "symfony/debug", diff --git a/src/ServiceProvider.php b/src/WorkflowServiceProvider.php similarity index 90% rename from src/ServiceProvider.php rename to src/WorkflowServiceProvider.php index aec934d..e62ffaa 100644 --- a/src/ServiceProvider.php +++ b/src/WorkflowServiceProvider.php @@ -2,9 +2,10 @@ namespace Brexis\LaravelWorkflow; +use Illuminate\Support\ServiceProvider; use WorkflowRegistry; -class ServiceProvider extends ServiceProvider +class WorkflowServiceProvider extends ServiceProvider { protected $commands = [ 'Brexis\LaravelWorkflow\Commands\WorkflowDumpCommand', From 62d8da6d02751776c9578d86eef705788f19593e Mon Sep 17 00:00:00 2001 From: Boris KOUMONDJI Date: Mon, 13 Feb 2017 01:21:39 +0100 Subject: [PATCH 13/83] Fix config file path --- src/WorkflowServiceProvider.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/WorkflowServiceProvider.php b/src/WorkflowServiceProvider.php index e62ffaa..55ea8a4 100644 --- a/src/WorkflowServiceProvider.php +++ b/src/WorkflowServiceProvider.php @@ -18,7 +18,7 @@ class WorkflowServiceProvider extends ServiceProvider */ public function boot() { - $configPath = __DIR__ . '/../../config/config.php'; + $configPath = __DIR__ . '/../config/config.php'; $this->publishes([$configPath => config_path('workflow.php')], 'config'); } From 905de326a381ea91672b948af83dde1ef3e5f5c9 Mon Sep 17 00:00:00 2001 From: Boris KOUMONDJI Date: Mon, 13 Feb 2017 01:58:52 +0100 Subject: [PATCH 14/83] Remove unused namespace --- src/WorkflowServiceProvider.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/WorkflowServiceProvider.php b/src/WorkflowServiceProvider.php index 55ea8a4..58bbafa 100644 --- a/src/WorkflowServiceProvider.php +++ b/src/WorkflowServiceProvider.php @@ -3,7 +3,6 @@ namespace Brexis\LaravelWorkflow; use Illuminate\Support\ServiceProvider; -use WorkflowRegistry; class WorkflowServiceProvider extends ServiceProvider { From 300795a3b1fe2494d1da954531b4f37d1aa88ec9 Mon Sep 17 00:00:00 2001 From: Boris KOUMONDJI Date: Mon, 13 Feb 2017 02:52:52 +0100 Subject: [PATCH 15/83] Add workflow_can and workflow_transitions blade extensions --- src/WorkflowServiceProvider.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/WorkflowServiceProvider.php b/src/WorkflowServiceProvider.php index 58bbafa..bce878b 100644 --- a/src/WorkflowServiceProvider.php +++ b/src/WorkflowServiceProvider.php @@ -3,6 +3,7 @@ namespace Brexis\LaravelWorkflow; use Illuminate\Support\ServiceProvider; +use Illuminate\Support\Facades\Blade; class WorkflowServiceProvider extends ServiceProvider { @@ -20,6 +21,8 @@ public function boot() $configPath = __DIR__ . '/../config/config.php'; $this->publishes([$configPath => config_path('workflow.php')], 'config'); + + $this->registerBladeExtensions(); } /** @@ -38,6 +41,24 @@ public function register() ); } + /** + * Register blades extensions + */ + private function registerBladeExtensions() + { + Blade::directive('workflow_can', function ($object, $transitionName, $workflowName = null) { + $workflow = Workflow::get($object, $workflowName); + + return $workflow->can($object, $transitionName); + }); + + Blade::directive('workflow_transitions', function ($object) { + $workflow = Workflow::get($object); + + return $workflow->getEnabledTransitions($object); + }); + } + /** * Get the services provided by the provider. * From 1e286359617dd6ab925f0201aae61b0fc4b16e9d Mon Sep 17 00:00:00 2001 From: Boris KOUMONDJI Date: Mon, 13 Feb 2017 03:52:33 +0100 Subject: [PATCH 16/83] Revert "Add workflow_can and workflow_transitions blade extensions" This reverts commit 300795a3b1fe2494d1da954531b4f37d1aa88ec9. --- src/WorkflowServiceProvider.php | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/src/WorkflowServiceProvider.php b/src/WorkflowServiceProvider.php index bce878b..58bbafa 100644 --- a/src/WorkflowServiceProvider.php +++ b/src/WorkflowServiceProvider.php @@ -3,7 +3,6 @@ namespace Brexis\LaravelWorkflow; use Illuminate\Support\ServiceProvider; -use Illuminate\Support\Facades\Blade; class WorkflowServiceProvider extends ServiceProvider { @@ -21,8 +20,6 @@ public function boot() $configPath = __DIR__ . '/../config/config.php'; $this->publishes([$configPath => config_path('workflow.php')], 'config'); - - $this->registerBladeExtensions(); } /** @@ -41,24 +38,6 @@ public function register() ); } - /** - * Register blades extensions - */ - private function registerBladeExtensions() - { - Blade::directive('workflow_can', function ($object, $transitionName, $workflowName = null) { - $workflow = Workflow::get($object, $workflowName); - - return $workflow->can($object, $transitionName); - }); - - Blade::directive('workflow_transitions', function ($object) { - $workflow = Workflow::get($object); - - return $workflow->getEnabledTransitions($object); - }); - } - /** * Get the services provided by the provider. * From 082ce53a19800f2c55f81642a1bb9ca57d2b8d3c Mon Sep 17 00:00:00 2001 From: Boris KOUMONDJI Date: Mon, 13 Feb 2017 03:59:25 +0100 Subject: [PATCH 17/83] Add traits --- src/Traits/WorkflowTrait.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/Traits/WorkflowTrait.php diff --git a/src/Traits/WorkflowTrait.php b/src/Traits/WorkflowTrait.php new file mode 100644 index 0000000..60ca54d --- /dev/null +++ b/src/Traits/WorkflowTrait.php @@ -0,0 +1,18 @@ +can($object, $transition); + } + + public function workflow_transitions($object) + { + return Workflow::get($object)->getEnabledTransitions($object); + } +} From c9d214a23470de12fb91b1b18c959f9ad7db2dc4 Mon Sep 17 00:00:00 2001 From: Boris KOUMONDJI Date: Mon, 13 Feb 2017 04:08:32 +0100 Subject: [PATCH 18/83] Simplify Workflow trait --- src/Traits/WorkflowTrait.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Traits/WorkflowTrait.php b/src/Traits/WorkflowTrait.php index 60ca54d..e92bf50 100644 --- a/src/Traits/WorkflowTrait.php +++ b/src/Traits/WorkflowTrait.php @@ -6,13 +6,13 @@ trait WorkflowTrait { - public function workflow_can($object, $transition, $workflow = null) + public function workflow_can($transition, $workflow = null) { - return Workflow::get($object, $workflow)->can($object, $transition); + return Workflow::get($this, $workflow)->can($this, $transition); } - public function workflow_transitions($object) + public function workflow_transitions() { - return Workflow::get($object)->getEnabledTransitions($object); + return Workflow::get($this)->getEnabledTransitions($this); } } From 7783d09150341d8befbd76c9ad16e7358c16b6e4 Mon Sep 17 00:00:00 2001 From: Boris KOUMONDJI Date: Mon, 13 Feb 2017 04:36:11 +0100 Subject: [PATCH 19/83] Add apply method to workflow trait --- src/Traits/WorkflowTrait.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Traits/WorkflowTrait.php b/src/Traits/WorkflowTrait.php index e92bf50..4c1d2a4 100644 --- a/src/Traits/WorkflowTrait.php +++ b/src/Traits/WorkflowTrait.php @@ -6,6 +6,11 @@ trait WorkflowTrait { + public function workflow_apply($transition, $workflow = null) + { + return Workflow::get($this, $workflow)->apply($this, $transition); + } + public function workflow_can($transition, $workflow = null) { return Workflow::get($this, $workflow)->can($this, $transition); From c09e518ae2bede61f34c8ef4758c0432b1300de4 Mon Sep 17 00:00:00 2001 From: Boris KOUMONDJI Date: Mon, 13 Feb 2017 05:20:56 +0100 Subject: [PATCH 20/83] Update readme file --- README.md | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/README.md b/README.md index 639f0e9..411b00e 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,8 @@ Use the Symfony Workflow component in Laravel Add a ServiceProvider to your providers array in `config/app.php`: ```php + [ ... Brexis\LaravelWorkflow\WorkflowServiceProvider::class, @@ -21,10 +23,16 @@ Add a ServiceProvider to your providers array in `config/app.php`: Add the `Workflow` facade to your facades array: ```php + Brexis\LaravelWorkflow\Facades\WorkflowFacade::class, ``` +Publish the config file + +``` + php artisan vendor:publish --provider="Brexis\LaravelWorkflow\WorkflowServiceProvider" +``` ### Configuration @@ -59,3 +67,60 @@ return [ ] ]; ``` + +Use the `WorkflowTrait` inside supported classes + +```php +can($post, 'publish'); // False +$workflow->can($post, 'to_review'); // True +$transitions = $workflow->getEnabledTransitions($post); + +// Apply a transition +$workflow->apply($post, 'to_review'); +$post->save(); // Don't forget to persist the state + +// Using the WorkflowTrait +$post->workflow_can('publish'); // True +$post->workflow_can('to_review'); // False + +// Get the post transitions +foreach ($post->workflow_transitions() as $transition) { + echo $transition->getName(); +} + +// Apply a transition +$post->workflow_apply('publish'); +$post->save(); +``` + +### Dump Workflows +Symfony workflow use GraphvizDumper to create the workflow image. You may need to install the `dot` command of [Graphviz](http://www.graphviz.org/) + + php artisan workflow:dump workflow_name + +You can change the image format with the `--format` option. By default the format is png. + + php artisan workflow:dump workflow_name --format=jpg From f95aa03dec638f3ba3494c30ac28ac43ad92447b Mon Sep 17 00:00:00 2001 From: Boris KOUMONDJI Date: Mon, 13 Feb 2017 05:25:08 +0100 Subject: [PATCH 21/83] R/Order/BlogPost --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 411b00e..a52e0fd 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,7 @@ namespace App; use Illuminate\Database\Eloquent\Model; use Brexis\LaravelWorkflow\Traits\WorkflowTrait; -class Order extends Model +class BlogPost extends Model { use WorkflowTrait; From 697380fdfdded0d98820b29a7457ded4fc216f46 Mon Sep 17 00:00:00 2001 From: Boris KOUMONDJI Date: Mon, 13 Feb 2017 05:41:32 +0100 Subject: [PATCH 22/83] Remove composer.lock --- .gitignore | 1 + composer.lock | 2357 ------------------------------------------------- 2 files changed, 1 insertion(+), 2357 deletions(-) delete mode 100644 composer.lock diff --git a/.gitignore b/.gitignore index 69119a8..4df5ff1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ vendor/ straight.png +composer.lock diff --git a/composer.lock b/composer.lock deleted file mode 100644 index bc8f68c..0000000 --- a/composer.lock +++ /dev/null @@ -1,2357 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", - "This file is @generated automatically" - ], - "content-hash": "c5dea795dd6604bf23588d75453e8059", - "packages": [ - { - "name": "doctrine/inflector", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/doctrine/inflector.git", - "reference": "803a2ed9fea02f9ca47cd45395089fe78769a392" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/inflector/zipball/803a2ed9fea02f9ca47cd45395089fe78769a392", - "reference": "803a2ed9fea02f9ca47cd45395089fe78769a392", - "shasum": "" - }, - "require": { - "php": ">=5.3.2" - }, - "require-dev": { - "phpunit/phpunit": "4.*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1.x-dev" - } - }, - "autoload": { - "psr-0": { - "Doctrine\\Common\\Inflector\\": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "Common String Manipulations with regard to casing and singular/plural rules.", - "homepage": "http://www.doctrine-project.org", - "keywords": [ - "inflection", - "pluralize", - "singularize", - "string" - ], - "time": "2016-05-12 17:23:41" - }, - { - "name": "illuminate/console", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/illuminate/console.git", - "reference": "6d85ccd08b6337eb7275f1d4d1e70589d0b4af6c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/illuminate/console/zipball/6d85ccd08b6337eb7275f1d4d1e70589d0b4af6c", - "reference": "6d85ccd08b6337eb7275f1d4d1e70589d0b4af6c", - "shasum": "" - }, - "require": { - "illuminate/contracts": "5.5.*", - "illuminate/support": "5.5.*", - "nesbot/carbon": "~1.20", - "php": ">=7.0", - "symfony/console": "~3.2" - }, - "suggest": { - "guzzlehttp/guzzle": "Required to use the ping methods on schedules (~6.0).", - "mtdowling/cron-expression": "Required to use scheduling component (~1.0).", - "symfony/process": "Required to use scheduling component (~3.2)." - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.5-dev" - } - }, - "autoload": { - "psr-4": { - "Illuminate\\Console\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" - } - ], - "description": "The Illuminate Console package.", - "homepage": "https://laravel.com", - "time": "2017-01-30 22:05:16" - }, - { - "name": "illuminate/contracts", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/illuminate/contracts.git", - "reference": "981b767f2eec48664ed0f7207a372ddf3c1ec5fb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/illuminate/contracts/zipball/981b767f2eec48664ed0f7207a372ddf3c1ec5fb", - "reference": "981b767f2eec48664ed0f7207a372ddf3c1ec5fb", - "shasum": "" - }, - "require": { - "php": ">=7.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.5-dev" - } - }, - "autoload": { - "psr-4": { - "Illuminate\\Contracts\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" - } - ], - "description": "The Illuminate Contracts package.", - "homepage": "https://laravel.com", - "time": "2017-02-10 21:32:45" - }, - { - "name": "illuminate/support", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/illuminate/support.git", - "reference": "1ea50a4359bc346ad3f9a804ee43ba023fccd27c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/illuminate/support/zipball/1ea50a4359bc346ad3f9a804ee43ba023fccd27c", - "reference": "1ea50a4359bc346ad3f9a804ee43ba023fccd27c", - "shasum": "" - }, - "require": { - "doctrine/inflector": "~1.0", - "ext-mbstring": "*", - "illuminate/contracts": "5.5.*", - "php": ">=7.0" - }, - "replace": { - "tightenco/collect": "self.version" - }, - "suggest": { - "illuminate/filesystem": "Required to use the composer class (5.2.*).", - "symfony/process": "Required to use the composer class (~3.2).", - "symfony/var-dumper": "Required to use the dd function (~3.2)." - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.5-dev" - } - }, - "autoload": { - "psr-4": { - "Illuminate\\Support\\": "" - }, - "files": [ - "helpers.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Taylor Otwell", - "email": "taylor@laravel.com" - } - ], - "description": "The Illuminate Support package.", - "homepage": "https://laravel.com", - "time": "2017-02-12 14:42:51" - }, - { - "name": "nesbot/carbon", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "926aee5ab38c2868816aa760f862a85ad01cb61a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/926aee5ab38c2868816aa760f862a85ad01cb61a", - "reference": "926aee5ab38c2868816aa760f862a85ad01cb61a", - "shasum": "" - }, - "require": { - "php": ">=5.3.0", - "symfony/translation": "~2.6 || ~3.0" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "~2", - "phpunit/phpunit": "~4.0 || ~5.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.23-dev" - } - }, - "autoload": { - "psr-4": { - "Carbon\\": "src/Carbon/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Brian Nesbitt", - "email": "brian@nesbot.com", - "homepage": "http://nesbot.com" - } - ], - "description": "A simple API extension for DateTime.", - "homepage": "http://carbon.nesbot.com", - "keywords": [ - "date", - "datetime", - "time" - ], - "time": "2017-02-06 22:02:47" - }, - { - "name": "paragonie/random_compat", - "version": "v2.0.4", - "source": { - "type": "git", - "url": "https://github.com/paragonie/random_compat.git", - "reference": "a9b97968bcde1c4de2a5ec6cbd06a0f6c919b46e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/paragonie/random_compat/zipball/a9b97968bcde1c4de2a5ec6cbd06a0f6c919b46e", - "reference": "a9b97968bcde1c4de2a5ec6cbd06a0f6c919b46e", - "shasum": "" - }, - "require": { - "php": ">=5.2.0" - }, - "require-dev": { - "phpunit/phpunit": "4.*|5.*" - }, - "suggest": { - "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." - }, - "type": "library", - "autoload": { - "files": [ - "lib/random.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Paragon Initiative Enterprises", - "email": "security@paragonie.com", - "homepage": "https://paragonie.com" - } - ], - "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", - "keywords": [ - "csprng", - "pseudorandom", - "random" - ], - "time": "2016-11-07T23:38:38+00:00" - }, - { - "name": "psr/log", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Log\\": "Psr/Log/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", - "keywords": [ - "log", - "psr", - "psr-3" - ], - "time": "2016-10-10 12:19:37" - }, - { - "name": "symfony/console", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/symfony/console.git", - "reference": "28698ac32c2694d4a3de8b17bf02fab2b7598ce0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/28698ac32c2694d4a3de8b17bf02fab2b7598ce0", - "reference": "28698ac32c2694d4a3de8b17bf02fab2b7598ce0", - "shasum": "" - }, - "require": { - "php": ">=5.5.9", - "symfony/debug": "~2.8|~3.0", - "symfony/polyfill-mbstring": "~1.0" - }, - "conflict": { - "symfony/dependency-injection": "<3.3" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/dependency-injection": "~3.3", - "symfony/event-dispatcher": "~2.8|~3.0", - "symfony/filesystem": "~2.8|~3.0", - "symfony/http-kernel": "~2.8|~3.0", - "symfony/process": "~2.8|~3.0" - }, - "suggest": { - "psr/log": "For using the console logger", - "symfony/event-dispatcher": "", - "symfony/filesystem": "", - "symfony/process": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.3-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Console\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Console Component", - "homepage": "https://symfony.com", - "time": "2017-02-06 12:04:42" - }, - { - "name": "symfony/debug", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/symfony/debug.git", - "reference": "6a980cb6c9c02f2b5313945de4d5567df2a4ef77" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/6a980cb6c9c02f2b5313945de4d5567df2a4ef77", - "reference": "6a980cb6c9c02f2b5313945de4d5567df2a4ef77", - "shasum": "" - }, - "require": { - "php": ">=5.5.9", - "psr/log": "~1.0" - }, - "conflict": { - "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" - }, - "require-dev": { - "symfony/http-kernel": "~2.8|~3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.3-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Debug\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Debug Component", - "homepage": "https://symfony.com", - "time": "2017-02-12 19:33:56" - }, - { - "name": "symfony/event-dispatcher", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "48e343e59e7c7f7cb6171b919082fb4a18df89a6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/48e343e59e7c7f7cb6171b919082fb4a18df89a6", - "reference": "48e343e59e7c7f7cb6171b919082fb4a18df89a6", - "shasum": "" - }, - "require": { - "php": ">=5.5.9" - }, - "conflict": { - "symfony/dependency-injection": "<3.3" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~2.8|~3.0", - "symfony/dependency-injection": "~3.3", - "symfony/expression-language": "~2.8|~3.0", - "symfony/stopwatch": "~2.8|~3.0" - }, - "suggest": { - "symfony/dependency-injection": "", - "symfony/http-kernel": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.3-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\EventDispatcher\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony EventDispatcher Component", - "homepage": "https://symfony.com", - "time": "2017-02-02 13:15:15" - }, - { - "name": "symfony/inflector", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/symfony/inflector.git", - "reference": "e16e5588af1e9b1956554333e742e2da41f787ea" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/inflector/zipball/e16e5588af1e9b1956554333e742e2da41f787ea", - "reference": "e16e5588af1e9b1956554333e742e2da41f787ea", - "shasum": "" - }, - "require": { - "php": ">=5.5.9" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.3-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Inflector\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Inflector Component", - "homepage": "https://symfony.com", - "keywords": [ - "inflection", - "pluralize", - "singularize", - "string", - "symfony", - "words" - ], - "time": "2017-01-02 20:33:09" - }, - { - "name": "symfony/polyfill-mbstring", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "e79d363049d1c2128f133a2667e4f4190904f7f4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/e79d363049d1c2128f133a2667e4f4190904f7f4", - "reference": "e79d363049d1c2128f133a2667e4f4190904f7f4", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-mbstring": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for the Mbstring extension", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" - ], - "time": "2016-11-14 01:06:16" - }, - { - "name": "symfony/polyfill-php70", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php70.git", - "reference": "13ce343935f0f91ca89605a2f6ca6f5c2f3faac2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/13ce343935f0f91ca89605a2f6ca6f5c2f3faac2", - "reference": "13ce343935f0f91ca89605a2f6ca6f5c2f3faac2", - "shasum": "" - }, - "require": { - "paragonie/random_compat": "~1.0|~2.0", - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php70\\": "" - }, - "files": [ - "bootstrap.php" - ], - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "time": "2016-11-14 01:06:16" - }, - { - "name": "symfony/process", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/symfony/process.git", - "reference": "37d005254947477f31d6878996b9adcafb2d3c44" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/37d005254947477f31d6878996b9adcafb2d3c44", - "reference": "37d005254947477f31d6878996b9adcafb2d3c44", - "shasum": "" - }, - "require": { - "php": ">=5.5.9" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.3-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Process\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Process Component", - "homepage": "https://symfony.com", - "time": "2017-02-08 15:45:40" - }, - { - "name": "symfony/property-access", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/symfony/property-access.git", - "reference": "51bc3ac8cb63c384e940180c00446c9368bf4be9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/property-access/zipball/51bc3ac8cb63c384e940180c00446c9368bf4be9", - "reference": "51bc3ac8cb63c384e940180c00446c9368bf4be9", - "shasum": "" - }, - "require": { - "php": ">=5.5.9", - "symfony/inflector": "~3.1", - "symfony/polyfill-php70": "~1.0" - }, - "require-dev": { - "symfony/cache": "~3.1" - }, - "suggest": { - "psr/cache-implementation": "To cache access methods." - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.3-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\PropertyAccess\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony PropertyAccess Component", - "homepage": "https://symfony.com", - "keywords": [ - "access", - "array", - "extraction", - "index", - "injection", - "object", - "property", - "property path", - "reflection" - ], - "time": "2017-02-02 13:49:58" - }, - { - "name": "symfony/translation", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/symfony/translation.git", - "reference": "5d598faac341f9ac753f327ec62903671d3da8d3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/5d598faac341f9ac753f327ec62903671d3da8d3", - "reference": "5d598faac341f9ac753f327ec62903671d3da8d3", - "shasum": "" - }, - "require": { - "php": ">=5.5.9", - "symfony/polyfill-mbstring": "~1.0" - }, - "conflict": { - "symfony/config": "<2.8" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~2.8|~3.0", - "symfony/intl": "~2.8|~3.0", - "symfony/yaml": "~2.8|~3.0" - }, - "suggest": { - "psr/log": "To use logging capability in translator", - "symfony/config": "", - "symfony/yaml": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.3-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Translation\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Translation Component", - "homepage": "https://symfony.com", - "time": "2017-01-21 17:10:26" - }, - { - "name": "symfony/workflow", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/symfony/workflow.git", - "reference": "c5659137631641af4bcc4800f3ed0cc3c3dd0f2a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/workflow/zipball/c5659137631641af4bcc4800f3ed0cc3c3dd0f2a", - "reference": "c5659137631641af4bcc4800f3ed0cc3c3dd0f2a", - "shasum": "" - }, - "require": { - "php": ">=5.5.9", - "symfony/property-access": "~2.3|~3.0" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/event-dispatcher": "~2.1|~3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.3-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Workflow\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Grégoire Pineau", - "email": "lyrixx@lyrixx.info" - } - ], - "description": "Symfony Workflow Component", - "homepage": "http://symfony.com", - "keywords": [ - "petrinet", - "place", - "transition", - "workflow" - ], - "time": "2017-01-21 17:10:26" - } - ], - "packages-dev": [ - { - "name": "doctrine/instantiator", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "68099b02b60bbf3b088ff5cb67bf506770ef9cac" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/68099b02b60bbf3b088ff5cb67bf506770ef9cac", - "reference": "68099b02b60bbf3b088ff5cb67bf506770ef9cac", - "shasum": "" - }, - "require": { - "php": ">=5.3,<8.0-DEV" - }, - "require-dev": { - "athletic/athletic": "~0.1.8", - "ext-pdo": "*", - "ext-phar": "*", - "phpunit/phpunit": "~4.0", - "squizlabs/php_codesniffer": "~2.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "http://ocramius.github.com/" - } - ], - "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://github.com/doctrine/instantiator", - "keywords": [ - "constructor", - "instantiate" - ], - "time": "2017-01-23 09:23:06" - }, - { - "name": "hamcrest/hamcrest-php", - "version": "1.2.x-dev", - "source": { - "type": "git", - "url": "https://github.com/hamcrest/hamcrest-php.git", - "reference": "b72949ccf2f640e7de66ff7dd92d83f577ce782e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/hamcrest/hamcrest-php/zipball/b72949ccf2f640e7de66ff7dd92d83f577ce782e", - "reference": "b72949ccf2f640e7de66ff7dd92d83f577ce782e", - "shasum": "" - }, - "require": { - "php": "^5.3|^7.0" - }, - "replace": { - "cordoval/hamcrest-php": "*", - "davedevelopment/hamcrest-php": "*", - "kodova/hamcrest-php": "*" - }, - "require-dev": { - "phpunit/php-file-iterator": "1.3.3", - "phpunit/phpunit": "~4.0", - "satooshi/php-coveralls": "^1.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2-dev" - } - }, - "autoload": { - "classmap": [ - "hamcrest" - ], - "files": [ - "hamcrest/Hamcrest.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD" - ], - "description": "This is the PHP port of Hamcrest Matchers", - "keywords": [ - "test" - ], - "time": "2016-01-19 12:08:55" - }, - { - "name": "mockery/mockery", - "version": "0.9.x-dev", - "source": { - "type": "git", - "url": "https://github.com/padraic/mockery.git", - "reference": "1e5e2ffdc4d71d7358ed58a6fdd30a4a0c506855" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/padraic/mockery/zipball/1e5e2ffdc4d71d7358ed58a6fdd30a4a0c506855", - "reference": "1e5e2ffdc4d71d7358ed58a6fdd30a4a0c506855", - "shasum": "" - }, - "require": { - "hamcrest/hamcrest-php": "~1.1", - "lib-pcre": ">=7.0", - "php": ">=5.3.2" - }, - "require-dev": { - "phpunit/phpunit": "~4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "0.9.x-dev" - } - }, - "autoload": { - "psr-0": { - "Mockery": "library/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Pádraic Brady", - "email": "padraic.brady@gmail.com", - "homepage": "http://blog.astrumfutura.com" - }, - { - "name": "Dave Marshall", - "email": "dave.marshall@atstsolutions.co.uk", - "homepage": "http://davedevelopment.co.uk" - } - ], - "description": "Mockery is a simple yet flexible PHP mock object framework for use in unit testing with PHPUnit, PHPSpec or any other testing framework. Its core goal is to offer a test double framework with a succinct API capable of clearly defining all possible object operations and interactions using a human readable Domain Specific Language (DSL). Designed as a drop in alternative to PHPUnit's phpunit-mock-objects library, Mockery is easy to integrate with PHPUnit and can operate alongside phpunit-mock-objects without the World ending.", - "homepage": "http://github.com/padraic/mockery", - "keywords": [ - "BDD", - "TDD", - "library", - "mock", - "mock objects", - "mockery", - "stub", - "test", - "test double", - "testing" - ], - "time": "2017-02-09 13:29:38" - }, - { - "name": "myclabs/deep-copy", - "version": "1.6.0", - "source": { - "type": "git", - "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "5a5a9fc8025a08d8919be87d6884d5a92520cefe" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/5a5a9fc8025a08d8919be87d6884d5a92520cefe", - "reference": "5a5a9fc8025a08d8919be87d6884d5a92520cefe", - "shasum": "" - }, - "require": { - "php": ">=5.4.0" - }, - "require-dev": { - "doctrine/collections": "1.*", - "phpunit/phpunit": "~4.1" - }, - "type": "library", - "autoload": { - "psr-4": { - "DeepCopy\\": "src/DeepCopy/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Create deep copies (clones) of your objects", - "homepage": "https://github.com/myclabs/DeepCopy", - "keywords": [ - "clone", - "copy", - "duplicate", - "object", - "object graph" - ], - "time": "2017-01-26T22:05:40+00:00" - }, - { - "name": "phpdocumentor/reflection-common", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/144c307535e82c8fdcaacbcfc1d6d8eeb896687c", - "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c", - "shasum": "" - }, - "require": { - "php": ">=5.5" - }, - "require-dev": { - "phpunit/phpunit": "^4.6" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jaap van Otterdijk", - "email": "opensource@ijaap.nl" - } - ], - "description": "Common reflection classes used by phpdocumentor to reflect the code structure", - "homepage": "http://www.phpdoc.org", - "keywords": [ - "FQSEN", - "phpDocumentor", - "phpdoc", - "reflection", - "static analysis" - ], - "time": "2015-12-27 11:43:31" - }, - { - "name": "phpdocumentor/reflection-docblock", - "version": "3.1.1", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/8331b5efe816ae05461b7ca1e721c01b46bafb3e", - "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e", - "shasum": "" - }, - "require": { - "php": ">=5.5", - "phpdocumentor/reflection-common": "^1.0@dev", - "phpdocumentor/type-resolver": "^0.2.0", - "webmozart/assert": "^1.0" - }, - "require-dev": { - "mockery/mockery": "^0.9.4", - "phpunit/phpunit": "^4.4" - }, - "type": "library", - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - } - ], - "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2016-09-30T07:12:33+00:00" - }, - { - "name": "phpdocumentor/type-resolver", - "version": "0.2.1", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb", - "reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb", - "shasum": "" - }, - "require": { - "php": ">=5.5", - "phpdocumentor/reflection-common": "^1.0" - }, - "require-dev": { - "mockery/mockery": "^0.9.4", - "phpunit/phpunit": "^5.2||^4.8.24" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - } - ], - "time": "2016-11-25T06:54:22+00:00" - }, - { - "name": "phpspec/prophecy", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/phpspec/prophecy.git", - "reference": "6c52c2722f8460122f96f86346600e1077ce22cb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/6c52c2722f8460122f96f86346600e1077ce22cb", - "reference": "6c52c2722f8460122f96f86346600e1077ce22cb", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.2", - "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "^2.0|^3.0.2", - "sebastian/comparator": "^1.1", - "sebastian/recursion-context": "^1.0|^2.0" - }, - "require-dev": { - "phpspec/phpspec": "^2.0", - "phpunit/phpunit": "^4.8 || ^5.6.5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.6.x-dev" - } - }, - "autoload": { - "psr-0": { - "Prophecy\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - }, - { - "name": "Marcello Duarte", - "email": "marcello.duarte@gmail.com" - } - ], - "description": "Highly opinionated mocking framework for PHP 5.3+", - "homepage": "https://github.com/phpspec/prophecy", - "keywords": [ - "Double", - "Dummy", - "fake", - "mock", - "spy", - "stub" - ], - "time": "2016-11-21 14:58:47" - }, - { - "name": "phpunit/php-code-coverage", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "e7d7a4acca58e45bdfd00221563d131cfb04ba96" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/e7d7a4acca58e45bdfd00221563d131cfb04ba96", - "reference": "e7d7a4acca58e45bdfd00221563d131cfb04ba96", - "shasum": "" - }, - "require": { - "php": "^7.0", - "phpunit/php-file-iterator": "^1.3", - "phpunit/php-text-template": "^1.2", - "phpunit/php-token-stream": "^1.4.2", - "sebastian/code-unit-reverse-lookup": "^1.0", - "sebastian/environment": "^2.0", - "sebastian/version": "^2.0" - }, - "require-dev": { - "ext-xdebug": "^2.5", - "phpunit/phpunit": "^6.0" - }, - "suggest": { - "ext-dom": "*", - "ext-xmlwriter": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", - "homepage": "https://github.com/sebastianbergmann/php-code-coverage", - "keywords": [ - "coverage", - "testing", - "xunit" - ], - "time": "2017-02-02 10:35:41" - }, - { - "name": "phpunit/php-file-iterator", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/3cc8f69b3028d0f96a9078e6295d86e9bf019be5", - "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "FilterIterator implementation that filters files based on a list of suffixes.", - "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", - "keywords": [ - "filesystem", - "iterator" - ], - "time": "2016-10-03 07:40:28" - }, - { - "name": "phpunit/php-text-template", - "version": "1.2.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Simple template engine.", - "homepage": "https://github.com/sebastianbergmann/php-text-template/", - "keywords": [ - "template" - ], - "time": "2015-06-21T13:50:34+00:00" - }, - { - "name": "phpunit/php-timer", - "version": "1.0.8", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/38e9124049cf1a164f1e4537caf19c99bf1eb260", - "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4|~5" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Utility class for timing", - "homepage": "https://github.com/sebastianbergmann/php-timer/", - "keywords": [ - "timer" - ], - "time": "2016-05-12T18:03:57+00:00" - }, - { - "name": "phpunit/php-token-stream", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "3b402f65a4cc90abf6e1104e388b896ce209631b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3b402f65a4cc90abf6e1104e388b896ce209631b", - "reference": "3b402f65a4cc90abf6e1104e388b896ce209631b", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Wrapper around PHP's tokenizer extension.", - "homepage": "https://github.com/sebastianbergmann/php-token-stream/", - "keywords": [ - "tokenizer" - ], - "time": "2016-11-15 14:06:22" - }, - { - "name": "phpunit/phpunit", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "c6f98e536ff91cf9663924e4b354ed9bc7b30dd2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c6f98e536ff91cf9663924e4b354ed9bc7b30dd2", - "reference": "c6f98e536ff91cf9663924e4b354ed9bc7b30dd2", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-json": "*", - "ext-libxml": "*", - "ext-mbstring": "*", - "ext-xml": "*", - "myclabs/deep-copy": "^1.3", - "php": "^7.0", - "phpspec/prophecy": "^1.6.2", - "phpunit/php-code-coverage": "^5.0", - "phpunit/php-file-iterator": "^1.4", - "phpunit/php-text-template": "^1.2", - "phpunit/php-timer": "^1.0.6", - "phpunit/phpunit-mock-objects": "^4.0", - "sebastian/comparator": "^1.2.4", - "sebastian/diff": "^1.2", - "sebastian/environment": "^2.0", - "sebastian/exporter": "^2.0", - "sebastian/global-state": "^1.1", - "sebastian/object-enumerator": "^2.0", - "sebastian/resource-operations": "^1.0", - "sebastian/version": "^2.0" - }, - "conflict": { - "phpdocumentor/reflection-docblock": "3.0.2", - "phpunit/dbunit": "<3.0" - }, - "require-dev": { - "ext-pdo": "*" - }, - "suggest": { - "ext-xdebug": "*", - "phpunit/php-invoker": "^1.1" - }, - "bin": [ - "phpunit" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "6.1.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "The PHP Unit Testing framework.", - "homepage": "https://phpunit.de/", - "keywords": [ - "phpunit", - "testing", - "xunit" - ], - "time": "2017-02-10 09:07:31" - }, - { - "name": "phpunit/phpunit-mock-objects", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "d89b9de0a9761552d263d7f5747db7a3053e991d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/d89b9de0a9761552d263d7f5747db7a3053e991d", - "reference": "d89b9de0a9761552d263d7f5747db7a3053e991d", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.2", - "php": "^7.0", - "phpunit/php-text-template": "^1.2", - "sebastian/exporter": "^2.0" - }, - "conflict": { - "phpunit/phpunit": "<6.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "suggest": { - "ext-soap": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Mock Object library for PHPUnit", - "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", - "keywords": [ - "mock", - "xunit" - ], - "time": "2017-02-05 15:27:55" - }, - { - "name": "sebastian/code-unit-reverse-lookup", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "11606652af09e847cdbbbc3ca17df26b1173a454" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/11606652af09e847cdbbbc3ca17df26b1173a454", - "reference": "11606652af09e847cdbbbc3ca17df26b1173a454", - "shasum": "" - }, - "require": { - "php": ">=5.6" - }, - "require-dev": { - "phpunit/phpunit": "~5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Looks up which function or method a line of code belongs to", - "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "time": "2016-12-06 20:05:00" - }, - { - "name": "sebastian/comparator", - "version": "1.2.x-dev", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", - "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "sebastian/diff": "~1.2", - "sebastian/exporter": "~1.2 || ~2.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides the functionality to compare PHP values for equality", - "homepage": "http://www.github.com/sebastianbergmann/comparator", - "keywords": [ - "comparator", - "compare", - "equality" - ], - "time": "2017-01-29 09:50:25" - }, - { - "name": "sebastian/diff", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "d0814318784b7756fb932116acd19ee3b0cbe67a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/d0814318784b7756fb932116acd19ee3b0cbe67a", - "reference": "d0814318784b7756fb932116acd19ee3b0cbe67a", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Diff implementation", - "homepage": "https://github.com/sebastianbergmann/diff", - "keywords": [ - "diff" - ], - "time": "2016-10-03 07:45:03" - }, - { - "name": "sebastian/environment", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/5795ffe5dc5b02460c3e34222fee8cbe245d8fac", - "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac", - "shasum": "" - }, - "require": { - "php": "^5.6 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", - "keywords": [ - "Xdebug", - "environment", - "hhvm" - ], - "time": "2016-11-26 07:53:53" - }, - { - "name": "sebastian/exporter", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4", - "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "sebastian/recursion-context": "~2.0" - }, - "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "~4.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", - "keywords": [ - "export", - "exporter" - ], - "time": "2016-11-19 08:54:04" - }, - { - "name": "sebastian/global-state", - "version": "1.1.x-dev", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "5a2b9ba59e8cf82fd1fdd7efb7d7846fd69ac36d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/5a2b9ba59e8cf82fd1fdd7efb7d7846fd69ac36d", - "reference": "5a2b9ba59e8cf82fd1fdd7efb7d7846fd69ac36d", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.2|~5.0" - }, - "suggest": { - "ext-uopz": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", - "keywords": [ - "global state" - ], - "time": "2016-10-03 07:46:22" - }, - { - "name": "sebastian/object-enumerator", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "96f8a3f257b69e8128ad74d3a7fd464bcbaa3b35" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/96f8a3f257b69e8128ad74d3a7fd464bcbaa3b35", - "reference": "96f8a3f257b69e8128ad74d3a7fd464bcbaa3b35", - "shasum": "" - }, - "require": { - "php": ">=5.6", - "sebastian/recursion-context": "~2.0" - }, - "require-dev": { - "phpunit/phpunit": "~5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Traverses array structures and object graphs to enumerate all referenced objects", - "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "time": "2016-11-19 07:35:10" - }, - { - "name": "sebastian/recursion-context", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/2c3ba150cbec723aa057506e73a8d33bdb286c9a", - "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2016-11-19 07:33:16" - }, - { - "name": "sebastian/resource-operations", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "fadc83f7c41fb2924e542635fea47ae546816ece" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/fadc83f7c41fb2924e542635fea47ae546816ece", - "reference": "fadc83f7c41fb2924e542635fea47ae546816ece", - "shasum": "" - }, - "require": { - "php": ">=5.6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides a list of PHP built-in functions that operate on resources", - "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "time": "2016-10-03 07:43:09" - }, - { - "name": "sebastian/version", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", - "shasum": "" - }, - "require": { - "php": ">=5.6" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library that helps with managing the version number of Git-hosted PHP projects", - "homepage": "https://github.com/sebastianbergmann/version", - "time": "2016-10-03 07:35:21" - }, - { - "name": "webmozart/assert", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/webmozart/assert.git", - "reference": "4a8bf11547e139e77b651365113fc12850c43d9a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/4a8bf11547e139e77b651365113fc12850c43d9a", - "reference": "4a8bf11547e139e77b651365113fc12850c43d9a", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.6", - "sebastian/version": "^1.0.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3-dev" - } - }, - "autoload": { - "psr-4": { - "Webmozart\\Assert\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Assertions to validate method input/output with nice error messages.", - "keywords": [ - "assert", - "check", - "validate" - ], - "time": "2016-11-23 20:04:41" - } - ], - "aliases": [], - "minimum-stability": "dev", - "stability-flags": [], - "prefer-stable": false, - "prefer-lowest": false, - "platform": { - "php": ">=5.5.9" - }, - "platform-dev": [] -} From b24ea8ce71ee264f4d99c5bd5565bc72d0dae02f Mon Sep 17 00:00:00 2001 From: Boris KOUMONDJI Date: Mon, 13 Feb 2017 11:51:41 +0100 Subject: [PATCH 23/83] R/use/uses --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a52e0fd..462c5cd 100644 --- a/README.md +++ b/README.md @@ -117,7 +117,7 @@ $post->save(); ``` ### Dump Workflows -Symfony workflow use GraphvizDumper to create the workflow image. You may need to install the `dot` command of [Graphviz](http://www.graphviz.org/) +Symfony workflow uses GraphvizDumper to create the workflow image. You may need to install the `dot` command of [Graphviz](http://www.graphviz.org/) php artisan workflow:dump workflow_name From d14a667fad7e814670b39b9de20e52ee2c81fbb5 Mon Sep 17 00:00:00 2001 From: Boris KOUMONDJI Date: Mon, 13 Feb 2017 11:51:49 +0100 Subject: [PATCH 24/83] Add comments --- src/WorkflowRegistry.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/WorkflowRegistry.php b/src/WorkflowRegistry.php index fd6a6b2..b8b925a 100644 --- a/src/WorkflowRegistry.php +++ b/src/WorkflowRegistry.php @@ -47,11 +47,22 @@ public function __construct(array $config) } } + /** + * Return the $subject workflo + * @param object $subject + * @param string $workflowName + * @return Workflow + */ public function get($subject, $workflowName = null) { return $this->registry->get($subject, $workflowName); } + /** + * Add a workflow to the subject + * @param Workflow $workflow + * @param Symfony\Component\Workflow\SupportStrategy\SupportStrategyInterface $supportStrategy + */ public function add(Workflow $workflow, $supportStrategy) { return $this->registry->add($workflow, $supportStrategy); From c5b48027d8f38b8f4790af731b6e93db5795116f Mon Sep 17 00:00:00 2001 From: Boris KOUMONDJI Date: Mon, 13 Feb 2017 14:03:42 +0100 Subject: [PATCH 25/83] Add support for workflow events --- src/Events/Announce.php | 18 +++++++++++ src/Events/Enter.php | 18 +++++++++++ src/Events/Entered.php | 18 +++++++++++ src/Events/EventDispatcher.php | 52 ------------------------------- src/Events/Guard.php | 18 +++++++++++ src/Events/Leave.php | 18 +++++++++++ src/Events/WorkflowSubscriber.php | 46 +++++++++++++++++++++++++++ src/WorkflowRegistry.php | 18 ++++++++--- 8 files changed, 150 insertions(+), 56 deletions(-) create mode 100644 src/Events/Announce.php create mode 100644 src/Events/Enter.php create mode 100644 src/Events/Entered.php delete mode 100644 src/Events/EventDispatcher.php create mode 100644 src/Events/Guard.php create mode 100644 src/Events/Leave.php create mode 100644 src/Events/WorkflowSubscriber.php diff --git a/src/Events/Announce.php b/src/Events/Announce.php new file mode 100644 index 0000000..e58f460 --- /dev/null +++ b/src/Events/Announce.php @@ -0,0 +1,18 @@ +event = $event; + } +} diff --git a/src/Events/Enter.php b/src/Events/Enter.php new file mode 100644 index 0000000..ae3b9d8 --- /dev/null +++ b/src/Events/Enter.php @@ -0,0 +1,18 @@ +event = $event; + } +} diff --git a/src/Events/Entered.php b/src/Events/Entered.php new file mode 100644 index 0000000..47b0e6d --- /dev/null +++ b/src/Events/Entered.php @@ -0,0 +1,18 @@ +event = $event; + } +} diff --git a/src/Events/EventDispatcher.php b/src/Events/EventDispatcher.php deleted file mode 100644 index ccb38e8..0000000 --- a/src/Events/EventDispatcher.php +++ /dev/null @@ -1,52 +0,0 @@ -event = $event; + } +} diff --git a/src/Events/Leave.php b/src/Events/Leave.php new file mode 100644 index 0000000..4c46966 --- /dev/null +++ b/src/Events/Leave.php @@ -0,0 +1,18 @@ +event = $event; + } +} diff --git a/src/Events/WorkflowSubscriber.php b/src/Events/WorkflowSubscriber.php new file mode 100644 index 0000000..fd900ff --- /dev/null +++ b/src/Events/WorkflowSubscriber.php @@ -0,0 +1,46 @@ + ['guardEvent'], + 'workflow.leave' => ['leaveEvent'], + 'workflow.transition' => ['transitionEvent'], + 'workflow.enter' => ['enterEvent'], + 'workflow.entered' => ['enteredEvent'], + 'workflow.announce' => ['announceEvent'] + ]; + } +} diff --git a/src/WorkflowRegistry.php b/src/WorkflowRegistry.php index b8b925a..53118c4 100644 --- a/src/WorkflowRegistry.php +++ b/src/WorkflowRegistry.php @@ -2,7 +2,8 @@ namespace Brexis\LaravelWorkflow; -use Brexis\LaravelWorkflow\Events\EventDispatcher; +use Brexis\LaravelWorkflow\Events\WorkflowSubscriber; +use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\Workflow\Definition; use Symfony\Component\Workflow\DefinitionBuilder; use Symfony\Component\Workflow\MarkingStore\MarkingStoreInterface; @@ -25,10 +26,19 @@ class WorkflowRegistry */ private $config; + /** + * @var EventDispatcher + */ + private $dispatcher; + public function __construct(array $config) { - $this->registry = new Registry(); - $this->config = $config; + $this->registry = new Registry(); + $this->config = $config; + $this->dispatcher = new EventDispatcher(); + + $subscriber = new WorkflowSubscriber(); + $this->dispatcher->addSubscriber($subscriber); foreach ($this->config as $name => $workflowData) { $builder = new DefinitionBuilder($workflowData['places']); @@ -88,7 +98,7 @@ private function getWorkflowInstance($name, $workflowData, Definition $definitio $className = $workflowData['class']; } - return new $className($definition, $markingStore, new EventDispatcher(), $name); + return new $className($definition, $markingStore, $this->dispatcher, $name); } /** From f71b15af5dd6a4cf38c8611ecafde3e33137e0a2 Mon Sep 17 00:00:00 2001 From: Boris KOUMONDJI Date: Mon, 13 Feb 2017 22:29:22 +0100 Subject: [PATCH 26/83] Add events unit test --- src/Events/Entered.php | 18 ------- src/Events/{Announce.php => Transition.php} | 2 +- src/Events/WorkflowSubscriber.php | 14 +----- tests/WorkflowSubscriberTest.php | 52 +++++++++++++++++++++ 4 files changed, 55 insertions(+), 31 deletions(-) delete mode 100644 src/Events/Entered.php rename src/Events/{Announce.php => Transition.php} (93%) create mode 100644 tests/WorkflowSubscriberTest.php diff --git a/src/Events/Entered.php b/src/Events/Entered.php deleted file mode 100644 index 47b0e6d..0000000 --- a/src/Events/Entered.php +++ /dev/null @@ -1,18 +0,0 @@ -event = $event; - } -} diff --git a/src/Events/Announce.php b/src/Events/Transition.php similarity index 93% rename from src/Events/Announce.php rename to src/Events/Transition.php index e58f460..844d425 100644 --- a/src/Events/Announce.php +++ b/src/Events/Transition.php @@ -4,7 +4,7 @@ use Symfony\Component\Workflow\Event\Event; -class Announce +class Transition { /** * @var Event diff --git a/src/Events/WorkflowSubscriber.php b/src/Events/WorkflowSubscriber.php index fd900ff..badec50 100644 --- a/src/Events/WorkflowSubscriber.php +++ b/src/Events/WorkflowSubscriber.php @@ -17,30 +17,20 @@ public function leaveEvent(Event $event) { } public function transitionEvent(Event $event) { - event(new Leave($event)); + event(new Transition($event)); } public function enterEvent(Event $event) { event(new Enter($event)); } - public function enteredEvent(Event $event) { - event(new Entered($event)); - } - - public function announceEvent(Event $event) { - event(new Announce($event)); - } - public static function getSubscribedEvents() { return [ 'workflow.guard' => ['guardEvent'], 'workflow.leave' => ['leaveEvent'], 'workflow.transition' => ['transitionEvent'], - 'workflow.enter' => ['enterEvent'], - 'workflow.entered' => ['enteredEvent'], - 'workflow.announce' => ['announceEvent'] + 'workflow.enter' => ['enterEvent'] ]; } } diff --git a/tests/WorkflowSubscriberTest.php b/tests/WorkflowSubscriberTest.php new file mode 100644 index 0000000..e21ff04 --- /dev/null +++ b/tests/WorkflowSubscriberTest.php @@ -0,0 +1,52 @@ + [ + 'supports' => ['TestObject'], + 'places' => ['a', 'b', 'c'], + 'transitions' => [ + 't1' => [ + 'from' => 'a', + 'to' => 'b', + ], + 't2' => [ + 'from' => 'b', + 'to' => 'c', + ] + ], + ] + ]; + + $registry = new WorkflowRegistry($config); + $object = new TestObject; + $workflow = $registry->get($object); + + $workflow->apply($object, 't1'); + + $this->assertTrue($events[0] instanceof Brexis\LaravelWorkflow\Events\Guard); + $this->assertTrue($events[1] instanceof Brexis\LaravelWorkflow\Events\Leave); + $this->assertTrue($events[2] instanceof Brexis\LaravelWorkflow\Events\Transition); + $this->assertTrue($events[3] instanceof Brexis\LaravelWorkflow\Events\Enter); + } +} From 306ce749e970b797ee8e7c70d76e58c22b017b33 Mon Sep 17 00:00:00 2001 From: Boris KOUMONDJI Date: Mon, 13 Feb 2017 22:53:23 +0100 Subject: [PATCH 27/83] Add events documentation --- README.md | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/README.md b/README.md index 462c5cd..d1764b4 100644 --- a/README.md +++ b/README.md @@ -116,6 +116,88 @@ $post->workflow_apply('publish'); $post->save(); ``` +### Use the events +This package provides a list of event fired during a transition + +```php + Brexis\LaravelWorkflow\Events\Guard + Brexis\LaravelWorkflow\Events\Leave + Brexis\LaravelWorkflow\Events\Transition + Brexis\LaravelWorkflow\Events\Enter +``` + +You can subscribe to an event + +```php +getSubject(); + $title = $post->title; + + if (empty($title)) { + // Posts with no title should not be allowed + $event->setBlocked(true); + } + } + + /** + * Handle workflow leave event. + */ + public function onLeave(Event $event) {} + + /** + * Handle workflow transition event. + */ + public function onTransition(Event $event) {} + + /** + * Handle workflow enter event. + */ + public function onEnter(Event $event) {} + + /** + * Register the listeners for the subscriber. + * + * @param Illuminate\Events\Dispatcher $events + */ + public function subscribe($events) + { + $events->listen( + 'Brexis\LaravelWorkflow\Events\Guard', + 'App\Listeners\BlogPostWorkflowSubscriber@onGuard' + ); + + $events->listen( + 'Brexis\LaravelWorkflow\Events\Leave', + 'App\Listeners\UserEventSubscriber@onLeave' + ); + + $events->listen( + 'Brexis\LaravelWorkflow\Events\Transition', + 'App\Listeners\UserEventSubscriber@onTransition' + ); + + $events->listen( + 'Brexis\LaravelWorkflow\Events\Enter', + 'App\Listeners\UserEventSubscriber@onEnter' + ); + } + +} +``` + ### Dump Workflows Symfony workflow uses GraphvizDumper to create the workflow image. You may need to install the `dot` command of [Graphviz](http://www.graphviz.org/) From fa8a2ab6021516014824e89e565048936ff98a47 Mon Sep 17 00:00:00 2001 From: Boris KOUMONDJI Date: Tue, 14 Feb 2017 23:41:37 +0100 Subject: [PATCH 28/83] Add class option to dumper command --- src/Commands/WorkflowDumpCommand.php | 23 ++++++++++++----------- tests/WorkflowDumpCommandTest.php | 3 +++ 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/Commands/WorkflowDumpCommand.php b/src/Commands/WorkflowDumpCommand.php index c59185f..157724d 100644 --- a/src/Commands/WorkflowDumpCommand.php +++ b/src/Commands/WorkflowDumpCommand.php @@ -19,7 +19,8 @@ class WorkflowDumpCommand extends Command */ protected $signature = 'workflow:dump {workflow : name of workflow from configuration} - {--format=png}'; + {--class= : the support class name} + {--format=png : the image format}'; /** * The console command description. @@ -36,25 +37,25 @@ class WorkflowDumpCommand extends Command */ public function handle() { - $workflowName = $this->argument('workflow'); - $config = Config::get('workflow'); + $workflowName = $this->argument('workflow'); + $format = $this->option('format'); + $class = $this->option('class'); + $config = Config::get('workflow'); if (!isset($config[$workflowName])) { throw new Exception("Workflow $workflowName is not configured."); } - $className = $config[$workflowName]['supports'][0]; // todo: add option to select single class? - - $workflow = Workflow::get(new $className, $workflowName); + if (false === array_search($class, $config[$workflowName]['supports'])) { + throw new Exception("Workflow $workflowName has no support for class $class"); + } - $property = new \ReflectionProperty(SynfonyWorkflow::class, 'definition'); - $property->setAccessible(true); - $definition = $property->getValue($workflow); + $subject = new $class; + $workflow = Workflow::get($subject, $workflowName); + $definition = $workflow->getDefinition(); $dumper = new GraphvizDumper(); - $format = $this->option('format'); - $dotCommand = "dot -T$format -o $workflowName.$format"; $process = new Process($dotCommand); diff --git a/tests/WorkflowDumpCommandTest.php b/tests/WorkflowDumpCommandTest.php index c49835d..ec3892f 100644 --- a/tests/WorkflowDumpCommandTest.php +++ b/tests/WorkflowDumpCommandTest.php @@ -54,6 +54,9 @@ public function testWorkflowCommand() ->shouldReceive('option') ->with('format') ->andReturn('png') + ->shouldReceive('option') + ->with('class') + ->andReturn('stdClass') ->getMock(); $command->handle(); From 75969aa974e64b8f160e1c963940fe7bcc6f8a37 Mon Sep 17 00:00:00 2001 From: Boris KOUMONDJI Date: Wed, 15 Feb 2017 00:36:08 +0100 Subject: [PATCH 29/83] Use a fixture class for test object --- composer.json | 5 ++ tests/Fixtures/TestObject.php | 7 +++ tests/WorkflowDumpCommandTest.php | 89 +++++++++++++++++-------------- tests/WorkflowRegistryTest.php | 44 ++++++++------- tests/WorkflowSubscriberTest.php | 59 ++++++++++---------- 5 files changed, 114 insertions(+), 90 deletions(-) create mode 100644 tests/Fixtures/TestObject.php diff --git a/composer.json b/composer.json index f577385..6f09bef 100644 --- a/composer.json +++ b/composer.json @@ -16,6 +16,11 @@ "Brexis\\LaravelWorkflow\\": "src/" } }, + "autoload-dev": { + "psr-4": { + "Tests\\": "tests/" + } + }, "extra": { "branch-alias": { "dev-master": "1.0-dev" diff --git a/tests/Fixtures/TestObject.php b/tests/Fixtures/TestObject.php new file mode 100644 index 0000000..50301de --- /dev/null +++ b/tests/Fixtures/TestObject.php @@ -0,0 +1,7 @@ +makePartial() + ->shouldReceive('argument') + ->with('workflow') + ->andReturn('straight') + ->shouldReceive('option') + ->with('format') + ->andReturn('png') + ->shouldReceive('option') + ->with('class') + ->andReturn('Tests\Fixtures\TestObject') + ->getMock(); + + $command->handle(); + + $this->assertTrue(file_exists('straight.png')); + } + } +} + +namespace { + use Brexis\LaravelWorkflow\WorkflowRegistry; + + $config = [ 'straight' => [ - 'supports' => ['stdClass'], + 'supports' => ['Tests\Fixtures\TestObject'], 'places' => ['a', 'b', 'c'], 'transitions' => [ 't1' => [ @@ -18,49 +47,27 @@ ] ], ] -]; + ]; -class Config -{ - public static function get($name) + class Workflow { - global $config; + public static function get($object, $name) + { + global $config; - return $config; - } -} - -class Workflow -{ - public static function get($object, $name) - { - global $config; + $workflowRegistry = new WorkflowRegistry($config); - $workflowRegistry = new WorkflowRegistry($config); - - return $workflowRegistry->get($object, $name); + return $workflowRegistry->get($object, $name); + } } -} -class WorkflowRegistryTest extends TestCase -{ - public function testWorkflowCommand() + class Config { - $command = Mockery::mock(WorkflowDumpCommand::class) - ->makePartial() - ->shouldReceive('argument') - ->with('workflow') - ->andReturn('straight') - ->shouldReceive('option') - ->with('format') - ->andReturn('png') - ->shouldReceive('option') - ->with('class') - ->andReturn('stdClass') - ->getMock(); - - $command->handle(); + public static function get($name) + { + global $config; - $this->assertTrue(file_exists('straight.png')); + return $config; + } } } diff --git a/tests/WorkflowRegistryTest.php b/tests/WorkflowRegistryTest.php index 875df65..d956ce8 100644 --- a/tests/WorkflowRegistryTest.php +++ b/tests/WorkflowRegistryTest.php @@ -1,18 +1,22 @@ [ - 'supports' => ['stdClass'], + 'supports' => ['Tests\Fixtures\TestObject'], 'places' => ['a', 'b', 'c'], 'transitions' => [ 't1' => [ @@ -27,28 +31,28 @@ public function testIfWorkflowIsRegisrter() ] ]; - $registry = new WorkflowRegistry($config); - $object = new stdClass; - $workflow = $registry->get($object); + $registry = new WorkflowRegistry($config); + $subject = new TestObject; + $workflow = $registry->get($subject); - $markingProp = new \ReflectionProperty(Workflow::class, 'markingStore'); - $markingProp->setAccessible(true); + $markingStoreProp = new ReflectionProperty(Workflow::class, 'markingStore'); + $markingStoreProp->setAccessible(true); - $marking = $markingProp->getValue($workflow); + $markingStore = $markingStoreProp->getValue($workflow); $this->assertTrue($workflow instanceof Workflow); - $this->assertTrue($marking instanceof SingleStateMarkingStore); + $this->assertTrue($markingStore instanceof SingleStateMarkingStore); } - public function testIfStateMachineIsRegisrter() + public function testIfStateMachineIsRegistered() { - $config = [ + $config = [ 'straight' => [ 'type' => 'state_machine', 'marking_store' => [ 'type' => 'multiple_state', ], - 'supports' => ['stdClass'], + 'supports' => ['Tests\Fixtures\TestObject'], 'places' => ['a', 'b', 'c'], 'transitions' => [ 't1' => [ @@ -63,16 +67,16 @@ public function testIfStateMachineIsRegisrter() ] ]; - $registry = new WorkflowRegistry($config); - $object = new stdClass; - $workflow = $registry->get($object); + $registry = new WorkflowRegistry($config); + $subject = new TestObject; + $workflow = $registry->get($subject); - $markingProp = new \ReflectionProperty(Workflow::class, 'markingStore'); - $markingProp->setAccessible(true); + $markingStoreProp = new ReflectionProperty(Workflow::class, 'markingStore'); + $markingStoreProp->setAccessible(true); - $marking = $markingProp->getValue($workflow); + $markingStore = $markingStoreProp->getValue($workflow); $this->assertTrue($workflow instanceof StateMachine); - $this->assertTrue($marking instanceof MultipleStateMarkingStore); + $this->assertTrue($markingStore instanceof MultipleStateMarkingStore); } } diff --git a/tests/WorkflowSubscriberTest.php b/tests/WorkflowSubscriberTest.php index e21ff04..0bde7bb 100644 --- a/tests/WorkflowSubscriberTest.php +++ b/tests/WorkflowSubscriberTest.php @@ -1,29 +1,19 @@ [ - 'supports' => ['TestObject'], + 'supports' => ['Tests\Fixtures\TestObject'], 'places' => ['a', 'b', 'c'], 'transitions' => [ 't1' => [ @@ -36,17 +26,28 @@ public function testIfWorkflowIsRegisrter() ] ], ] - ]; + ]; - $registry = new WorkflowRegistry($config); - $object = new TestObject; - $workflow = $registry->get($object); + $registry = new WorkflowRegistry($config); + $object = new TestObject; + $workflow = $registry->get($object); - $workflow->apply($object, 't1'); + $workflow->apply($object, 't1'); - $this->assertTrue($events[0] instanceof Brexis\LaravelWorkflow\Events\Guard); - $this->assertTrue($events[1] instanceof Brexis\LaravelWorkflow\Events\Leave); - $this->assertTrue($events[2] instanceof Brexis\LaravelWorkflow\Events\Transition); - $this->assertTrue($events[3] instanceof Brexis\LaravelWorkflow\Events\Enter); + $this->assertTrue($events[0] instanceof \Brexis\LaravelWorkflow\Events\Guard); + $this->assertTrue($events[1] instanceof \Brexis\LaravelWorkflow\Events\Leave); + $this->assertTrue($events[2] instanceof \Brexis\LaravelWorkflow\Events\Transition); + $this->assertTrue($events[3] instanceof \Brexis\LaravelWorkflow\Events\Enter); + } + } +} + +namespace { + $events = null; + + function event($ev) + { + global $events; + $events[] = $ev; } } From 72ff6a53bec8cf746cc60ceeb6faeefeca2d87f5 Mon Sep 17 00:00:00 2001 From: Boris KOUMONDJI Date: Fri, 17 Feb 2017 02:06:55 +0100 Subject: [PATCH 30/83] Change events class name --- README.md | 16 ++++++++-------- src/Events/BaseEvent.php | 27 +++++++++++++++++++++++++++ src/Events/Enter.php | 18 ------------------ src/Events/EnterEvent.php | 7 +++++++ src/Events/Guard.php | 18 ------------------ src/Events/GuardEvent.php | 13 +++++++++++++ src/Events/Leave.php | 18 ------------------ src/Events/LeaveEvent.php | 7 +++++++ src/Events/Transition.php | 18 ------------------ src/Events/TransitionEvent.php | 7 +++++++ src/Events/WorkflowSubscriber.php | 12 ++++++------ tests/WorkflowSubscriberTest.php | 8 ++++---- 12 files changed, 79 insertions(+), 90 deletions(-) create mode 100644 src/Events/BaseEvent.php delete mode 100644 src/Events/Enter.php create mode 100644 src/Events/EnterEvent.php delete mode 100644 src/Events/Guard.php create mode 100644 src/Events/GuardEvent.php delete mode 100644 src/Events/Leave.php create mode 100644 src/Events/LeaveEvent.php delete mode 100644 src/Events/Transition.php create mode 100644 src/Events/TransitionEvent.php diff --git a/README.md b/README.md index d1764b4..728c235 100644 --- a/README.md +++ b/README.md @@ -133,39 +133,39 @@ You can subscribe to an event namespace App\Listeners; -use Symfony\Component\Workflow\Event\GuardEvent; -use Symfony\Component\Workflow\Event\Event; - class BlogPostWorkflowSubscriber { /** * Handle workflow guard events. */ public function onGuard(GuardEvent $event) { + /** Symfony\Component\Workflow\Event\GuardEvent */ + $originalEvent = $event->getOriginalEvent(); + /** @var App\BlogPost $post */ - $post = $event->getSubject(); + $post = $originalEvent->getSubject(); $title = $post->title; if (empty($title)) { // Posts with no title should not be allowed - $event->setBlocked(true); + $originalEvent->setBlocked(true); } } /** * Handle workflow leave event. */ - public function onLeave(Event $event) {} + public function onLeave($event) {} /** * Handle workflow transition event. */ - public function onTransition(Event $event) {} + public function onTransition($event) {} /** * Handle workflow enter event. */ - public function onEnter(Event $event) {} + public function onEnter($event) {} /** * Register the listeners for the subscriber. diff --git a/src/Events/BaseEvent.php b/src/Events/BaseEvent.php new file mode 100644 index 0000000..4d23477 --- /dev/null +++ b/src/Events/BaseEvent.php @@ -0,0 +1,27 @@ +originalEvent = $event; + } + + /** + * Return the original event + * @return Event + */ + public function getOriginalEvent() + { + return $this->originalEvent; + } +} diff --git a/src/Events/Enter.php b/src/Events/Enter.php deleted file mode 100644 index ae3b9d8..0000000 --- a/src/Events/Enter.php +++ /dev/null @@ -1,18 +0,0 @@ -event = $event; - } -} diff --git a/src/Events/EnterEvent.php b/src/Events/EnterEvent.php new file mode 100644 index 0000000..39b37d0 --- /dev/null +++ b/src/Events/EnterEvent.php @@ -0,0 +1,7 @@ +event = $event; - } -} diff --git a/src/Events/GuardEvent.php b/src/Events/GuardEvent.php new file mode 100644 index 0000000..2b5c4a7 --- /dev/null +++ b/src/Events/GuardEvent.php @@ -0,0 +1,13 @@ +originalEvent = $event; + } +} diff --git a/src/Events/Leave.php b/src/Events/Leave.php deleted file mode 100644 index 4c46966..0000000 --- a/src/Events/Leave.php +++ /dev/null @@ -1,18 +0,0 @@ -event = $event; - } -} diff --git a/src/Events/LeaveEvent.php b/src/Events/LeaveEvent.php new file mode 100644 index 0000000..e675add --- /dev/null +++ b/src/Events/LeaveEvent.php @@ -0,0 +1,7 @@ +event = $event; - } -} diff --git a/src/Events/TransitionEvent.php b/src/Events/TransitionEvent.php new file mode 100644 index 0000000..d9793a9 --- /dev/null +++ b/src/Events/TransitionEvent.php @@ -0,0 +1,7 @@ +apply($object, 't1'); - $this->assertTrue($events[0] instanceof \Brexis\LaravelWorkflow\Events\Guard); - $this->assertTrue($events[1] instanceof \Brexis\LaravelWorkflow\Events\Leave); - $this->assertTrue($events[2] instanceof \Brexis\LaravelWorkflow\Events\Transition); - $this->assertTrue($events[3] instanceof \Brexis\LaravelWorkflow\Events\Enter); + $this->assertTrue($events[0] instanceof \Brexis\LaravelWorkflow\Events\GuardEvent); + $this->assertTrue($events[1] instanceof \Brexis\LaravelWorkflow\Events\LeaveEvent); + $this->assertTrue($events[2] instanceof \Brexis\LaravelWorkflow\Events\TransitionEvent); + $this->assertTrue($events[3] instanceof \Brexis\LaravelWorkflow\Events\EnterEvent); } } } From 1139a61d9da2bf5b71541f10f9923d9bc08da3cf Mon Sep 17 00:00:00 2001 From: Boris KOUMONDJI Date: Fri, 17 Feb 2017 02:10:03 +0100 Subject: [PATCH 31/83] Add comments --- src/Commands/WorkflowDumpCommand.php | 3 +++ src/Events/BaseEvent.php | 3 +++ src/Events/EnterEvent.php | 3 +++ src/Events/GuardEvent.php | 3 +++ src/Events/LeaveEvent.php | 3 +++ src/Events/TransitionEvent.php | 3 +++ src/Events/WorkflowSubscriber.php | 3 +++ src/Facades/WorkflowFacade.php | 5 ++++- src/Traits/WorkflowTrait.php | 3 +++ src/WorkflowRegistry.php | 3 +++ src/WorkflowServiceProvider.php | 3 +++ 11 files changed, 34 insertions(+), 1 deletion(-) diff --git a/src/Commands/WorkflowDumpCommand.php b/src/Commands/WorkflowDumpCommand.php index 157724d..b61087e 100644 --- a/src/Commands/WorkflowDumpCommand.php +++ b/src/Commands/WorkflowDumpCommand.php @@ -10,6 +10,9 @@ use Symfony\Component\Workflow\Workflow as SynfonyWorkflow; use Workflow; +/** + * @author Boris Koumondji + */ class WorkflowDumpCommand extends Command { /** diff --git a/src/Events/BaseEvent.php b/src/Events/BaseEvent.php index 4d23477..d126f31 100644 --- a/src/Events/BaseEvent.php +++ b/src/Events/BaseEvent.php @@ -4,6 +4,9 @@ use Symfony\Component\Workflow\Event\Event; +/** + * @author Boris Koumondji + */ abstract class BaseEvent { /** diff --git a/src/Events/EnterEvent.php b/src/Events/EnterEvent.php index 39b37d0..172ae3e 100644 --- a/src/Events/EnterEvent.php +++ b/src/Events/EnterEvent.php @@ -2,6 +2,9 @@ namespace Brexis\LaravelWorkflow\Events; +/** + * @author Boris Koumondji + */ class EnterEvent extends BaseEvent { } diff --git a/src/Events/GuardEvent.php b/src/Events/GuardEvent.php index 2b5c4a7..0b1b625 100644 --- a/src/Events/GuardEvent.php +++ b/src/Events/GuardEvent.php @@ -4,6 +4,9 @@ use Symfony\Component\Workflow\Event\GuardEvent as SymfonyGuardEvent; +/** + * @author Boris Koumondji + */ class GuardEvent extends BaseEvent { public function __construct(SymfonyGuardEvent $event) diff --git a/src/Events/LeaveEvent.php b/src/Events/LeaveEvent.php index e675add..96b04a7 100644 --- a/src/Events/LeaveEvent.php +++ b/src/Events/LeaveEvent.php @@ -2,6 +2,9 @@ namespace Brexis\LaravelWorkflow\Events; +/** + * @author Boris Koumondji + */ class LeaveEvent extends BaseEvent { } diff --git a/src/Events/TransitionEvent.php b/src/Events/TransitionEvent.php index d9793a9..5ecfb4d 100644 --- a/src/Events/TransitionEvent.php +++ b/src/Events/TransitionEvent.php @@ -2,6 +2,9 @@ namespace Brexis\LaravelWorkflow\Events; +/** + * @author Boris Koumondji + */ class TransitionEvent extends BaseEvent { } diff --git a/src/Events/WorkflowSubscriber.php b/src/Events/WorkflowSubscriber.php index 6483490..b192fbe 100644 --- a/src/Events/WorkflowSubscriber.php +++ b/src/Events/WorkflowSubscriber.php @@ -6,6 +6,9 @@ use Symfony\Component\Workflow\Event\GuardEvent as SymfonyGuardEvent; use Symfony\Component\EventDispatcher\EventSubscriberInterface; +/** + * @author Boris Koumondji + */ class WorkflowSubscriber implements EventSubscriberInterface { public function guardEvent(SymfonyGuardEvent $event) { diff --git a/src/Facades/WorkflowFacade.php b/src/Facades/WorkflowFacade.php index b83392d..49b5480 100644 --- a/src/Facades/WorkflowFacade.php +++ b/src/Facades/WorkflowFacade.php @@ -4,10 +4,13 @@ use Illuminate\Support\Facades\Facade; +/** + * @author Boris Koumondji + */ class WorkflowFacade extends Facade { protected static function getFacadeAccessor() { return 'workflow'; } -} \ No newline at end of file +} diff --git a/src/Traits/WorkflowTrait.php b/src/Traits/WorkflowTrait.php index 4c1d2a4..6a47a19 100644 --- a/src/Traits/WorkflowTrait.php +++ b/src/Traits/WorkflowTrait.php @@ -4,6 +4,9 @@ use Workflow; +/** + * @author Boris Koumondji + */ trait WorkflowTrait { public function workflow_apply($transition, $workflow = null) diff --git a/src/WorkflowRegistry.php b/src/WorkflowRegistry.php index 53118c4..3da7867 100644 --- a/src/WorkflowRegistry.php +++ b/src/WorkflowRegistry.php @@ -14,6 +14,9 @@ use Symfony\Component\Workflow\Transition; use Symfony\Component\Workflow\Workflow; +/** + * @author Boris Koumondji + */ class WorkflowRegistry { /** diff --git a/src/WorkflowServiceProvider.php b/src/WorkflowServiceProvider.php index 58bbafa..0fec9b3 100644 --- a/src/WorkflowServiceProvider.php +++ b/src/WorkflowServiceProvider.php @@ -4,6 +4,9 @@ use Illuminate\Support\ServiceProvider; +/** + * @author Boris Koumondji + */ class WorkflowServiceProvider extends ServiceProvider { protected $commands = [ From 9f2c8d6ab441ade0b4cc9917fed43c7cf9f1766f Mon Sep 17 00:00:00 2001 From: Boris KOUMONDJI Date: Fri, 17 Feb 2017 02:12:17 +0100 Subject: [PATCH 32/83] Change event classes in READEME --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 728c235..b1ebf92 100644 --- a/README.md +++ b/README.md @@ -175,22 +175,22 @@ class BlogPostWorkflowSubscriber public function subscribe($events) { $events->listen( - 'Brexis\LaravelWorkflow\Events\Guard', + 'Brexis\LaravelWorkflow\Events\GuardEvent', 'App\Listeners\BlogPostWorkflowSubscriber@onGuard' ); $events->listen( - 'Brexis\LaravelWorkflow\Events\Leave', + 'Brexis\LaravelWorkflow\Events\LeaveEvent', 'App\Listeners\UserEventSubscriber@onLeave' ); $events->listen( - 'Brexis\LaravelWorkflow\Events\Transition', + 'Brexis\LaravelWorkflow\Events\TransitionEvent', 'App\Listeners\UserEventSubscriber@onTransition' ); $events->listen( - 'Brexis\LaravelWorkflow\Events\Enter', + 'Brexis\LaravelWorkflow\Events\EnterEvent', 'App\Listeners\UserEventSubscriber@onEnter' ); } From f47cefc98d1ac00e9e71e9c136bae3a1e4774eb8 Mon Sep 17 00:00:00 2001 From: Ilia Smirnov Date: Wed, 24 May 2017 11:33:57 +0300 Subject: [PATCH 33/83] Fixed copy/paste error in readme Listeners must be attached to `App\Listeners\BlogPostWorkflowSubscriber`, not `App\Listeners\UserEventSubscriber` --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b1ebf92..4f88b14 100644 --- a/README.md +++ b/README.md @@ -181,17 +181,17 @@ class BlogPostWorkflowSubscriber $events->listen( 'Brexis\LaravelWorkflow\Events\LeaveEvent', - 'App\Listeners\UserEventSubscriber@onLeave' + 'App\Listeners\BlogPostWorkflowSubscriber@onLeave' ); $events->listen( 'Brexis\LaravelWorkflow\Events\TransitionEvent', - 'App\Listeners\UserEventSubscriber@onTransition' + 'App\Listeners\BlogPostWorkflowSubscriber@onTransition' ); $events->listen( 'Brexis\LaravelWorkflow\Events\EnterEvent', - 'App\Listeners\UserEventSubscriber@onEnter' + 'App\Listeners\BlogPostWorkflowSubscriber@onEnter' ); } From 225d460d4b116e59fdc975c93a3796b4185304e7 Mon Sep 17 00:00:00 2001 From: Claudio Varandas Date: Tue, 6 Jun 2017 12:38:47 +0100 Subject: [PATCH 34/83] fixes deprecated class name warning due to symfony upgrade 3.3 --- src/WorkflowRegistry.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/WorkflowRegistry.php b/src/WorkflowRegistry.php index 3da7867..9676cab 100644 --- a/src/WorkflowRegistry.php +++ b/src/WorkflowRegistry.php @@ -13,6 +13,7 @@ use Symfony\Component\Workflow\StateMachine; use Symfony\Component\Workflow\Transition; use Symfony\Component\Workflow\Workflow; +use Symfony\Component\Workflow\SupportStrategy\ClassInstanceSupportStrategy; /** * @author Boris Koumondji @@ -55,7 +56,7 @@ public function __construct(array $config) $workflow = $this->getWorkflowInstance($name, $workflowData, $definition, $markingStore); foreach ($workflowData['supports'] as $supportedClass) { - $this->registry->add($workflow, $supportedClass); + $this->registry->add($workflow, new ClassInstanceSupportStrategy($supportedClass)); } } } From aaea3b97cfb7b475d924a95e2d7f3c326e176aa9 Mon Sep 17 00:00:00 2001 From: Claudio Varandas Date: Tue, 6 Jun 2017 15:23:38 +0100 Subject: [PATCH 35/83] -ignores phpstorm files -fixes deprecated class name warning due to symfony upgrade 3.3 --- .gitignore | 1 + src/WorkflowRegistry.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 4df5ff1..7ac8b99 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ vendor/ straight.png composer.lock +.idea \ No newline at end of file diff --git a/src/WorkflowRegistry.php b/src/WorkflowRegistry.php index 9676cab..2fcf84e 100644 --- a/src/WorkflowRegistry.php +++ b/src/WorkflowRegistry.php @@ -79,7 +79,7 @@ public function get($subject, $workflowName = null) */ public function add(Workflow $workflow, $supportStrategy) { - return $this->registry->add($workflow, $supportStrategy); + return $this->registry->add($workflow, new ClassInstanceSupportStrategy($supportStrategy)); } /** From b489f89bb7526460761a54760fb7f85b8299d818 Mon Sep 17 00:00:00 2001 From: zerodahero Date: Wed, 6 Sep 2017 14:08:15 -0500 Subject: [PATCH 36/83] emitting symfony-style events to allow for cleaner multiple workflow scenarios --- src/Events/WorkflowSubscriber.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Events/WorkflowSubscriber.php b/src/Events/WorkflowSubscriber.php index b192fbe..04f5862 100644 --- a/src/Events/WorkflowSubscriber.php +++ b/src/Events/WorkflowSubscriber.php @@ -12,19 +12,19 @@ class WorkflowSubscriber implements EventSubscriberInterface { public function guardEvent(SymfonyGuardEvent $event) { - event(new GuardEvent($event)); + event('workflow.'.$event->getWorkflowName().'.guard', $event); } public function leaveEvent(Event $event) { - event(new LeaveEvent($event)); + event('workflow.'.$event->getWorkflowName().'.leave', $event); } public function transitionEvent(Event $event) { - event(new TransitionEvent($event)); + event('workflow.'.$event->getWorkflowName().'.transition', $event); } public function enterEvent(Event $event) { - event(new EnterEvent($event)); + event('workflow.'.$event->getWorkflowName().'.enter', $event); } public static function getSubscribedEvents() From dd59be3af061a03484ed242859449ab8bf996777 Mon Sep 17 00:00:00 2001 From: zerodahero Date: Wed, 6 Sep 2017 15:12:20 -0500 Subject: [PATCH 37/83] updated unit test --- tests/WorkflowSubscriberTest.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/WorkflowSubscriberTest.php b/tests/WorkflowSubscriberTest.php index 8729bc1..2cccf40 100644 --- a/tests/WorkflowSubscriberTest.php +++ b/tests/WorkflowSubscriberTest.php @@ -4,6 +4,7 @@ use PHPUnit\Framework\TestCase; use Brexis\LaravelWorkflow\WorkflowRegistry; use Tests\Fixtures\TestObject; + use Illuminate\Support\Facades\Event; class WorkflowRegistryTest extends TestCase { @@ -34,10 +35,10 @@ public function testIfWorkflowIsRegisrter() $workflow->apply($object, 't1'); - $this->assertTrue($events[0] instanceof \Brexis\LaravelWorkflow\Events\GuardEvent); - $this->assertTrue($events[1] instanceof \Brexis\LaravelWorkflow\Events\LeaveEvent); - $this->assertTrue($events[2] instanceof \Brexis\LaravelWorkflow\Events\TransitionEvent); - $this->assertTrue($events[3] instanceof \Brexis\LaravelWorkflow\Events\EnterEvent); + $this->assertTrue($events[0] == "workflow.straight.guard"); + $this->assertTrue($events[1] == "workflow.straight.leave"); + $this->assertTrue($events[2] == "workflow.straight.transition"); + $this->assertTrue($events[3] == "workflow.straight.enter"); } } } From 4b2a203e1713a6ce91da01cd6fcb7493a27614a3 Mon Sep 17 00:00:00 2001 From: Boris KOUMONDJI Date: Fri, 17 Nov 2017 10:37:54 +0100 Subject: [PATCH 38/83] Fix test classes name --- src/WorkflowRegistry.php | 4 ++-- tests/WorkflowDumpCommandTest.php | 2 +- tests/WorkflowSubscriberTest.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/WorkflowRegistry.php b/src/WorkflowRegistry.php index 9676cab..23b4088 100644 --- a/src/WorkflowRegistry.php +++ b/src/WorkflowRegistry.php @@ -56,7 +56,7 @@ public function __construct(array $config) $workflow = $this->getWorkflowInstance($name, $workflowData, $definition, $markingStore); foreach ($workflowData['supports'] as $supportedClass) { - $this->registry->add($workflow, new ClassInstanceSupportStrategy($supportedClass)); + $this->add($workflow, $supportedClass); } } } @@ -79,7 +79,7 @@ public function get($subject, $workflowName = null) */ public function add(Workflow $workflow, $supportStrategy) { - return $this->registry->add($workflow, $supportStrategy); + return $this->registry->add($workflow, new ClassInstanceSupportStrategy($supportStrategy)); } /** diff --git a/tests/WorkflowDumpCommandTest.php b/tests/WorkflowDumpCommandTest.php index 74f3ae7..59802f3 100644 --- a/tests/WorkflowDumpCommandTest.php +++ b/tests/WorkflowDumpCommandTest.php @@ -5,7 +5,7 @@ use Mockery; use PHPUnit\Framework\TestCase; - class WorkflowRegistryTest extends TestCase + class WorkflowDumpCommandTest extends TestCase { public function testWorkflowCommand() { diff --git a/tests/WorkflowSubscriberTest.php b/tests/WorkflowSubscriberTest.php index 8729bc1..1dbda4b 100644 --- a/tests/WorkflowSubscriberTest.php +++ b/tests/WorkflowSubscriberTest.php @@ -5,7 +5,7 @@ use Brexis\LaravelWorkflow\WorkflowRegistry; use Tests\Fixtures\TestObject; - class WorkflowRegistryTest extends TestCase + class WorkflowSubscriberTest extends TestCase { public function testIfWorkflowIsRegisrter() { From 6b58ee8c1f81e1053ee3f617f6402983070a0c69 Mon Sep 17 00:00:00 2001 From: Boris KOUMONDJI Date: Fri, 17 Nov 2017 10:38:24 +0100 Subject: [PATCH 39/83] Compatibily for laravel version 5.3 --- composer.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 6f09bef..15accff 100644 --- a/composer.json +++ b/composer.json @@ -8,8 +8,8 @@ "symfony/workflow": "^3.2", "symfony/process": "^3.1", "symfony/event-dispatcher": "^3.1", - "illuminate/console": "^5.3", - "illuminate/support": "^5.3" + "illuminate/console": "5.3.*", + "illuminate/support": "5.3.*" }, "autoload": { "psr-4": { @@ -26,7 +26,6 @@ "dev-master": "1.0-dev" } }, - "minimum-stability": "dev", "require-dev": { "mockery/mockery": "^0.9.8", "phpunit/phpunit": "^6.0" From 0c90659ccb1483c0b233072325b72eedc0138b01 Mon Sep 17 00:00:00 2001 From: Boris KOUMONDJI Date: Fri, 17 Nov 2017 12:36:17 +0100 Subject: [PATCH 40/83] Enable event hook wildcards --- src/Events/WorkflowSubscriber.php | 4 ++++ tests/WorkflowSubscriberTest.php | 13 ++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/Events/WorkflowSubscriber.php b/src/Events/WorkflowSubscriber.php index 04f5862..7b08012 100644 --- a/src/Events/WorkflowSubscriber.php +++ b/src/Events/WorkflowSubscriber.php @@ -12,18 +12,22 @@ class WorkflowSubscriber implements EventSubscriberInterface { public function guardEvent(SymfonyGuardEvent $event) { + event(new GuardEvent($event)); event('workflow.'.$event->getWorkflowName().'.guard', $event); } public function leaveEvent(Event $event) { + event(new LeaveEvent($event)); event('workflow.'.$event->getWorkflowName().'.leave', $event); } public function transitionEvent(Event $event) { + event(new TransitionEvent($event)); event('workflow.'.$event->getWorkflowName().'.transition', $event); } public function enterEvent(Event $event) { + event(new EnterEvent($event)); event('workflow.'.$event->getWorkflowName().'.enter', $event); } diff --git a/tests/WorkflowSubscriberTest.php b/tests/WorkflowSubscriberTest.php index 8be4283..32e9b0e 100644 --- a/tests/WorkflowSubscriberTest.php +++ b/tests/WorkflowSubscriberTest.php @@ -4,7 +4,6 @@ use PHPUnit\Framework\TestCase; use Brexis\LaravelWorkflow\WorkflowRegistry; use Tests\Fixtures\TestObject; - use Illuminate\Support\Facades\Event; class WorkflowSubscriberTest extends TestCase { @@ -35,10 +34,14 @@ public function testIfWorkflowIsRegisrter() $workflow->apply($object, 't1'); - $this->assertTrue($events[0] == "workflow.straight.guard"); - $this->assertTrue($events[1] == "workflow.straight.leave"); - $this->assertTrue($events[2] == "workflow.straight.transition"); - $this->assertTrue($events[3] == "workflow.straight.enter"); + $this->assertTrue($events[0] instanceof \Brexis\LaravelWorkflow\Events\GuardEvent); + $this->assertTrue($events[1] == "workflow.straight.guard"); + $this->assertTrue($events[2] instanceof \Brexis\LaravelWorkflow\Events\LeaveEvent); + $this->assertTrue($events[3] == "workflow.straight.leave"); + $this->assertTrue($events[4] instanceof \Brexis\LaravelWorkflow\Events\TransitionEvent); + $this->assertTrue($events[5] == "workflow.straight.transition"); + $this->assertTrue($events[6] instanceof \Brexis\LaravelWorkflow\Events\EnterEvent); + $this->assertTrue($events[7] == "workflow.straight.enter"); } } } From 14760cf10cc8b93ca4773809fb1189a29d01a2a5 Mon Sep 17 00:00:00 2001 From: Lauren Date: Fri, 17 Nov 2017 11:57:13 +0000 Subject: [PATCH 41/83] Allow multiple transitions with the same name This works in Symfony's Workflow but laravel-workflow doesn't have a way to reference multiple transitions with the same name in the config file. This patch adds support for the alternative notation referenced in symfony/symfony#22558 that uses a `name` field rather than inferring the transition name from the key. E.g. ``` 't1' => [ 'from' => 'a', 'to' => 'b', ] ``` becomes ``` [ 'name' => 't1', 'from' => 'a', 'to' => 'b', ] ``` which allows multiple transitions with the same name. --- src/WorkflowRegistry.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/WorkflowRegistry.php b/src/WorkflowRegistry.php index 2fcf84e..4cb3d42 100644 --- a/src/WorkflowRegistry.php +++ b/src/WorkflowRegistry.php @@ -48,6 +48,10 @@ public function __construct(array $config) $builder = new DefinitionBuilder($workflowData['places']); foreach ($workflowData['transitions'] as $transitionName => $transition) { + if (!is_string($transitionName)) { + $transitionName = $transition['name']; + } + $builder->addTransition(new Transition($transitionName, $transition['from'], $transition['to'])); } From 96c12d0d9f5e7f64671d6229869583e0fdcf5cf0 Mon Sep 17 00:00:00 2001 From: Boris KOUMONDJI Date: Fri, 17 Nov 2017 14:27:04 +0100 Subject: [PATCH 42/83] Add compatibly for laravel 5.4 and 5.5 --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 15accff..2e8b87f 100644 --- a/composer.json +++ b/composer.json @@ -8,8 +8,8 @@ "symfony/workflow": "^3.2", "symfony/process": "^3.1", "symfony/event-dispatcher": "^3.1", - "illuminate/console": "5.3.*", - "illuminate/support": "5.3.*" + "illuminate/console": "5.3.* | 5.4.* | 5.5.*", + "illuminate/support": "5.3.* | 5.4.* | 5.5.*" }, "autoload": { "psr-4": { From 05a41c4fa3fa0581cccd8af9af941604a7168ebe Mon Sep 17 00:00:00 2001 From: Lauren Date: Fri, 17 Nov 2017 13:43:31 +0000 Subject: [PATCH 43/83] Add test for multiple transitions with the same name Also fixed the existing tests since there were errors that prevent the tests from running. --- tests/WorkflowDumpCommandTest.php | 2 +- tests/WorkflowRegistryTest.php | 46 +++++++++++++++++++++++++++++++ tests/WorkflowSubscriberTest.php | 6 ++-- 3 files changed, 51 insertions(+), 3 deletions(-) diff --git a/tests/WorkflowDumpCommandTest.php b/tests/WorkflowDumpCommandTest.php index 74f3ae7..59802f3 100644 --- a/tests/WorkflowDumpCommandTest.php +++ b/tests/WorkflowDumpCommandTest.php @@ -5,7 +5,7 @@ use Mockery; use PHPUnit\Framework\TestCase; - class WorkflowRegistryTest extends TestCase + class WorkflowDumpCommandTest extends TestCase { public function testWorkflowCommand() { diff --git a/tests/WorkflowRegistryTest.php b/tests/WorkflowRegistryTest.php index d956ce8..91e12b5 100644 --- a/tests/WorkflowRegistryTest.php +++ b/tests/WorkflowRegistryTest.php @@ -79,4 +79,50 @@ public function testIfStateMachineIsRegistered() $this->assertTrue($workflow instanceof StateMachine); $this->assertTrue($markingStore instanceof MultipleStateMarkingStore); } + + public function testIfTransitionsWithSameNameCanBothBeUsed() + { + $config = [ + 'straight' => [ + 'type' => 'state_machine', + 'supports' => ['Tests\Fixtures\TestObject'], + 'places' => ['a', 'b', 'c'], + 'transitions' => [ + [ + 'name' => 't1', + 'from' => 'a', + 'to' => 'b', + ], + [ + 'name' => 't1', + 'from' => 'c', + 'to' => 'b', + ], + [ + 'name' => 't2', + 'from' => 'b', + 'to' => 'c', + ] + ], + ] + ]; + + $registry = new WorkflowRegistry($config); + $subject = new TestObject; + $workflow = $registry->get($subject); + + $markingStoreProp = new ReflectionProperty(Workflow::class, 'markingStore'); + $markingStoreProp->setAccessible(true); + + $markingStore = $markingStoreProp->getValue($workflow); + + $this->assertTrue($workflow instanceof StateMachine); + $this->assertTrue($markingStore instanceof SingleStateMarkingStore); + $this->assertTrue($workflow->can($subject, 't1')); + + $workflow->apply($subject, 't1'); + $workflow->apply($subject, 't2'); + + $this->assertTrue($workflow->can($subject, 't1')); + } } diff --git a/tests/WorkflowSubscriberTest.php b/tests/WorkflowSubscriberTest.php index 2cccf40..7e03e9c 100644 --- a/tests/WorkflowSubscriberTest.php +++ b/tests/WorkflowSubscriberTest.php @@ -6,12 +6,14 @@ use Tests\Fixtures\TestObject; use Illuminate\Support\Facades\Event; - class WorkflowRegistryTest extends TestCase + class WorkflowSubscriberTest extends TestCase { - public function testIfWorkflowIsRegisrter() + public function testIfWorkflowEmitsEvents() { global $events; + $events = []; + $config = [ 'straight' => [ 'supports' => ['Tests\Fixtures\TestObject'], From 99d93e076170086fe3c8ec83778e937f43c36368 Mon Sep 17 00:00:00 2001 From: Boris KOUMONDJI Date: Fri, 17 Nov 2017 15:26:31 +0100 Subject: [PATCH 44/83] Upgrade symfony components versions --- composer.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 2e8b87f..35a433c 100644 --- a/composer.json +++ b/composer.json @@ -5,9 +5,9 @@ "license": "MIT", "require": { "php": ">=5.5.9", - "symfony/workflow": "^3.2", - "symfony/process": "^3.1", - "symfony/event-dispatcher": "^3.1", + "symfony/workflow": "^3.3", + "symfony/process": "^3.3", + "symfony/event-dispatcher": "^3.3", "illuminate/console": "5.3.* | 5.4.* | 5.5.*", "illuminate/support": "5.3.* | 5.4.* | 5.5.*" }, From 876075fb4721d98872d043a901bac461b8e2fda8 Mon Sep 17 00:00:00 2001 From: Boris KOUMONDJI Date: Fri, 17 Nov 2017 15:26:58 +0100 Subject: [PATCH 45/83] Make sure to delete dump file before the command test --- tests/WorkflowDumpCommandTest.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/WorkflowDumpCommandTest.php b/tests/WorkflowDumpCommandTest.php index 59802f3..eec75cc 100644 --- a/tests/WorkflowDumpCommandTest.php +++ b/tests/WorkflowDumpCommandTest.php @@ -9,6 +9,10 @@ class WorkflowDumpCommandTest extends TestCase { public function testWorkflowCommand() { + if (file_exists('straight.png')) { + unlink('straight.png'); + } + $command = Mockery::mock(WorkflowDumpCommand::class) ->makePartial() ->shouldReceive('argument') From 344deb2408c2bdb43f0ffca9ec2ce5d33cb37099 Mon Sep 17 00:00:00 2001 From: Boris KOUMONDJI Date: Fri, 17 Nov 2017 15:44:17 +0100 Subject: [PATCH 46/83] Add package auto-discovering feature --- composer.json | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/composer.json b/composer.json index 35a433c..36093ce 100644 --- a/composer.json +++ b/composer.json @@ -24,6 +24,14 @@ "extra": { "branch-alias": { "dev-master": "1.0-dev" + }, + "laravel": { + "providers": [ + "Brexis\\LaravelWorkflow\\WorkflowServiceProvider" + ], + "aliases": { + "Workflow": "Brexis\\LaravelWorkflow\\Facades\\WorkflowFacade" + } } }, "require-dev": { From 24635a3d93966a428d1d148a1529229a35b18b3c Mon Sep 17 00:00:00 2001 From: Boris KOUMONDJI Date: Fri, 17 Nov 2017 15:46:34 +0100 Subject: [PATCH 47/83] Add instruction for laravel <= 5.4 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4f88b14..c423d65 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Use the Symfony Workflow component in Laravel composer require brexis/laravel-workflow -#### Laravel 5 +#### For laravel <= 5.4 Add a ServiceProvider to your providers array in `config/app.php`: From 1b66e31618a86e8b68f136c82acfcb91e3b7f89f Mon Sep 17 00:00:00 2001 From: Boris KOUMONDJI Date: Fri, 17 Nov 2017 15:47:59 +0100 Subject: [PATCH 48/83] Update readme file --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c423d65..8d65825 100644 --- a/README.md +++ b/README.md @@ -28,14 +28,14 @@ Add the `Workflow` facade to your facades array: 'Workflow' => Brexis\LaravelWorkflow\Facades\WorkflowFacade::class, ``` +### Configuration + Publish the config file ``` php artisan vendor:publish --provider="Brexis\LaravelWorkflow\WorkflowServiceProvider" ``` -### Configuration - Configure your workflow in `config/workflow.php` ```php From d398935428e3d229444ddad697010b6c4355028a Mon Sep 17 00:00:00 2001 From: Anton Kartsev Date: Wed, 29 Nov 2017 17:33:59 +0300 Subject: [PATCH 49/83] Added entered Event --- src/Events/EnteredEvent.php | 10 ++++++++++ src/Events/WorkflowSubscriber.php | 8 +++++++- 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 src/Events/EnteredEvent.php diff --git a/src/Events/EnteredEvent.php b/src/Events/EnteredEvent.php new file mode 100644 index 0000000..39774d9 --- /dev/null +++ b/src/Events/EnteredEvent.php @@ -0,0 +1,10 @@ + + */ +class EnteredEvent extends BaseEvent +{ +} diff --git a/src/Events/WorkflowSubscriber.php b/src/Events/WorkflowSubscriber.php index 7b08012..a3471bc 100644 --- a/src/Events/WorkflowSubscriber.php +++ b/src/Events/WorkflowSubscriber.php @@ -31,13 +31,19 @@ public function enterEvent(Event $event) { event('workflow.'.$event->getWorkflowName().'.enter', $event); } + public function enteredEvent(Event $event) { + event(new EnteredEvent($event)); + event('workflow.'.$event->getWorkflowName().'.entered', $event); + } + public static function getSubscribedEvents() { return [ 'workflow.guard' => ['guardEvent'], 'workflow.leave' => ['leaveEvent'], 'workflow.transition' => ['transitionEvent'], - 'workflow.enter' => ['enterEvent'] + 'workflow.enter' => ['enterEvent'], + 'workflow.entered' => ['enteredEvent'], ]; } } From 0a541d9d89eb758b0c0fdd146b400ac983a55e55 Mon Sep 17 00:00:00 2001 From: Anton Kartsev Date: Thu, 30 Nov 2017 11:47:39 +0300 Subject: [PATCH 50/83] added test for entered event --- tests/WorkflowSubscriberTest.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/WorkflowSubscriberTest.php b/tests/WorkflowSubscriberTest.php index 1e7cf11..301f752 100644 --- a/tests/WorkflowSubscriberTest.php +++ b/tests/WorkflowSubscriberTest.php @@ -44,6 +44,8 @@ public function testIfWorkflowEmitsEvents() $this->assertTrue($events[5] == "workflow.straight.transition"); $this->assertTrue($events[6] instanceof \Brexis\LaravelWorkflow\Events\EnterEvent); $this->assertTrue($events[7] == "workflow.straight.enter"); + $this->assertTrue($events[8] instanceof \Brexis\LaravelWorkflow\Events\EnteredEvent); + $this->assertTrue($events[9] == "workflow.straight.entered"); } } } From 3c60e8bebdf03c093b2b5e484c8fef6795342da2 Mon Sep 17 00:00:00 2001 From: Boris KOUMONDJI Date: Fri, 1 Dec 2017 00:28:41 +0100 Subject: [PATCH 51/83] Add travis config file --- .travis.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..48be567 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,14 @@ +language: php + +php: + - 5.4 + - 5.6 + - 7.0 + - 7.1 + +before_script: + - composer self-update + - composer install --no-interaction + +script: + - vendor/bin/phpunit From 68fa5c2f3e1edbce6cd3231943ab7d857db53862 Mon Sep 17 00:00:00 2001 From: Boris KOUMONDJI Date: Fri, 1 Dec 2017 01:06:30 +0100 Subject: [PATCH 52/83] Add graphviz installation instruction --- .travis.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 48be567..54ae72f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,11 @@ language: php php: - - 5.4 - - 5.6 - 7.0 - 7.1 +before_install: + - wget http://204.178.9.49/pub/graphviz/stable/ubuntu/ub13.10/x86_64/graphviz_2.38.0-1~saucy_amd64.deb + - sudo dpkg -i graphviz_2.38.0-1~saucy_amd64.deb before_script: - composer self-update From f842117117e3925cac3b1b9e5d11617aed888ad6 Mon Sep 17 00:00:00 2001 From: Boris KOUMONDJI Date: Fri, 1 Dec 2017 01:10:18 +0100 Subject: [PATCH 53/83] Fix graphviz installation instruction --- .travis.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 54ae72f..c7cfd11 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,8 +4,10 @@ php: - 7.0 - 7.1 before_install: - - wget http://204.178.9.49/pub/graphviz/stable/ubuntu/ub13.10/x86_64/graphviz_2.38.0-1~saucy_amd64.deb - - sudo dpkg -i graphviz_2.38.0-1~saucy_amd64.deb + - sudo apt-add-repository ppa:dperry/ppa-graphviz-test + - sudo apt-get update + - sudo apt-get autoremove graphviz + - sudo apt-get install graphviz before_script: - composer self-update From ef70e91ff8cae917a52b4a8d07d453f717327468 Mon Sep 17 00:00:00 2001 From: Boris KOUMONDJI Date: Fri, 1 Dec 2017 01:12:50 +0100 Subject: [PATCH 54/83] -y --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c7cfd11..8d25935 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ php: - 7.0 - 7.1 before_install: - - sudo apt-add-repository ppa:dperry/ppa-graphviz-test + - sudo apt-add-repository ppa:dperry/ppa-graphviz-test -y - sudo apt-get update - sudo apt-get autoremove graphviz - sudo apt-get install graphviz From 9845dfcf26013815d8412a75d2f5253458cfea7a Mon Sep 17 00:00:00 2001 From: Boris KOUMONDJI Date: Fri, 1 Dec 2017 01:13:52 +0100 Subject: [PATCH 55/83] -y --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8d25935..1cf394c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,9 +5,9 @@ php: - 7.1 before_install: - sudo apt-add-repository ppa:dperry/ppa-graphviz-test -y - - sudo apt-get update - - sudo apt-get autoremove graphviz - - sudo apt-get install graphviz + - sudo apt-get update -q + - sudo apt-get autoremove graphviz -y + - sudo apt-get install graphviz -y before_script: - composer self-update From 5d990f3002d5511189f86ec46f9a1c7aeab876a2 Mon Sep 17 00:00:00 2001 From: Boris KOUMONDJI Date: Fri, 1 Dec 2017 01:17:53 +0100 Subject: [PATCH 56/83] travis fix --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1cf394c..7cc8e3a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,6 @@ php: - 7.0 - 7.1 before_install: - - sudo apt-add-repository ppa:dperry/ppa-graphviz-test -y - sudo apt-get update -q - sudo apt-get autoremove graphviz -y - sudo apt-get install graphviz -y From df0a01a316cdda91c7c479a223fbd9afd5699716 Mon Sep 17 00:00:00 2001 From: Boris KOUMONDJI Date: Fri, 1 Dec 2017 01:23:42 +0100 Subject: [PATCH 57/83] Add workflow entered event documentation --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 8d65825..92b2aee 100644 --- a/README.md +++ b/README.md @@ -167,6 +167,11 @@ class BlogPostWorkflowSubscriber */ public function onEnter($event) {} + /** + * Handle workflow entered event. + */ + public function onEntered($event) {} + /** * Register the listeners for the subscriber. * @@ -193,6 +198,11 @@ class BlogPostWorkflowSubscriber 'Brexis\LaravelWorkflow\Events\EnterEvent', 'App\Listeners\BlogPostWorkflowSubscriber@onEnter' ); + + $events->listen( + 'Brexis\LaravelWorkflow\Events\EnteredEvent', + 'App\Listeners\BlogPostWorkflowSubscriber@onEntered' + ); } } From b882c07e44f21b46cebcf83038f34025670279ab Mon Sep 17 00:00:00 2001 From: Boris KOUMONDJI Date: Fri, 1 Dec 2017 01:29:15 +0100 Subject: [PATCH 58/83] Include travis status image --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 92b2aee..49cde96 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Laravel workflow +# Laravel workflow [![Build Status](https://travis-ci.org/brexis/laravel-workflow.svg?branch=1.1.2)](https://travis-ci.org/brexis/laravel-workflow) Use the Symfony Workflow component in Laravel From be4bc58a8fd352e0b88e2adbee5034ab0e59cee8 Mon Sep 17 00:00:00 2001 From: Boris KOUMONDJI Date: Sun, 3 Dec 2017 18:59:25 +0100 Subject: [PATCH 59/83] Add Entered event in the list of events --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 49cde96..cd49f2a 100644 --- a/README.md +++ b/README.md @@ -117,13 +117,14 @@ $post->save(); ``` ### Use the events -This package provides a list of event fired during a transition +This package provides a list of events fired during a transition ```php Brexis\LaravelWorkflow\Events\Guard Brexis\LaravelWorkflow\Events\Leave Brexis\LaravelWorkflow\Events\Transition Brexis\LaravelWorkflow\Events\Enter + Brexis\LaravelWorkflow\Events\Entered ``` You can subscribe to an event From a2597802045e148f48d56a037645559f0f7e28c3 Mon Sep 17 00:00:00 2001 From: Peter Smeets Date: Fri, 12 Jan 2018 15:20:01 +0100 Subject: [PATCH 60/83] Added more event subscribers to conform to the way Symfony has the events set up. Also updated and added assert statements. --- src/Events/WorkflowSubscriber.php | 45 ++++++++++++------- tests/WorkflowSubscriberTest.php | 73 ++++++++++++++++++++----------- 2 files changed, 77 insertions(+), 41 deletions(-) diff --git a/src/Events/WorkflowSubscriber.php b/src/Events/WorkflowSubscriber.php index a3471bc..85cd924 100644 --- a/src/Events/WorkflowSubscriber.php +++ b/src/Events/WorkflowSubscriber.php @@ -11,39 +11,54 @@ */ class WorkflowSubscriber implements EventSubscriberInterface { - public function guardEvent(SymfonyGuardEvent $event) { + public function guardEvent(SymfonyGuardEvent $event) + { event(new GuardEvent($event)); - event('workflow.'.$event->getWorkflowName().'.guard', $event); + event('workflow.guard', $event); + event('workflow.' . $event->getWorkflowName() . '.guard', $event); + event('workflow.' . $event->getWorkflowName() . '.guard.' . $event->getTransition()->getName(), $event); } - public function leaveEvent(Event $event) { + public function leaveEvent(Event $event) + { event(new LeaveEvent($event)); - event('workflow.'.$event->getWorkflowName().'.leave', $event); + event('workflow.leave', $event); + event('workflow.' . $event->getWorkflowName() . '.leave', $event); + event('workflow.' . $event->getWorkflowName() . '.leave.' . $event->getTransition()->getName(), $event); } - public function transitionEvent(Event $event) { + public function transitionEvent(Event $event) + { event(new TransitionEvent($event)); - event('workflow.'.$event->getWorkflowName().'.transition', $event); + event('workflow.transition', $event); + event('workflow.' . $event->getWorkflowName() . '.transition', $event); + event('workflow.' . $event->getWorkflowName() . '.transition.' . $event->getTransition()->getName(), $event); } - public function enterEvent(Event $event) { + public function enterEvent(Event $event) + { event(new EnterEvent($event)); - event('workflow.'.$event->getWorkflowName().'.enter', $event); + event('workflow.enter', $event); + event('workflow.' . $event->getWorkflowName() . '.enter', $event); + event('workflow.' . $event->getWorkflowName() . '.enter.' . $event->getTransition()->getName(), $event); } - public function enteredEvent(Event $event) { + public function enteredEvent(Event $event) + { event(new EnteredEvent($event)); - event('workflow.'.$event->getWorkflowName().'.entered', $event); + event('workflow.entered', $event); + event('workflow.' . $event->getWorkflowName() . '.entered', $event); + event('workflow.' . $event->getWorkflowName() . '.entered.' . $event->getTransition()->getName(), $event); } public static function getSubscribedEvents() { return [ - 'workflow.guard' => ['guardEvent'], - 'workflow.leave' => ['leaveEvent'], - 'workflow.transition' => ['transitionEvent'], - 'workflow.enter' => ['enterEvent'], - 'workflow.entered' => ['enteredEvent'], + 'workflow.guard' => ['guardEvent'], + 'workflow.leave' => ['leaveEvent'], + 'workflow.transition' => ['transitionEvent'], + 'workflow.enter' => ['enterEvent'], + 'workflow.entered' => ['enteredEvent'], ]; } } diff --git a/tests/WorkflowSubscriberTest.php b/tests/WorkflowSubscriberTest.php index 301f752..830d0fb 100644 --- a/tests/WorkflowSubscriberTest.php +++ b/tests/WorkflowSubscriberTest.php @@ -1,6 +1,12 @@ [ - 'supports' => ['Tests\Fixtures\TestObject'], - 'places' => ['a', 'b', 'c'], - 'transitions' => [ - 't1' => [ - 'from' => 'a', - 'to' => 'b', + $config = [ + 'straight' => [ + 'supports' => [TestObject::class], + 'places' => ['a', 'b', 'c'], + 'transitions' => [ + 't1' => [ + 'from' => 'a', + 'to' => 'b', + ], + 't2' => [ + 'from' => 'b', + 'to' => 'c', + ], ], - 't2' => [ - 'from' => 'b', - 'to' => 'c', - ] ], - ] ]; - $registry = new WorkflowRegistry($config); - $object = new TestObject; - $workflow = $registry->get($object); + $registry = new WorkflowRegistry($config); + $object = new TestObject; + $workflow = $registry->get($object); $workflow->apply($object, 't1'); - $this->assertTrue($events[0] instanceof \Brexis\LaravelWorkflow\Events\GuardEvent); - $this->assertTrue($events[1] == "workflow.straight.guard"); - $this->assertTrue($events[2] instanceof \Brexis\LaravelWorkflow\Events\LeaveEvent); - $this->assertTrue($events[3] == "workflow.straight.leave"); - $this->assertTrue($events[4] instanceof \Brexis\LaravelWorkflow\Events\TransitionEvent); - $this->assertTrue($events[5] == "workflow.straight.transition"); - $this->assertTrue($events[6] instanceof \Brexis\LaravelWorkflow\Events\EnterEvent); - $this->assertTrue($events[7] == "workflow.straight.enter"); - $this->assertTrue($events[8] instanceof \Brexis\LaravelWorkflow\Events\EnteredEvent); - $this->assertTrue($events[9] == "workflow.straight.entered"); + $this->assertInstanceOf(GuardEvent::class, $events[0]); + $this->assertEquals('workflow.guard', $events[1]); + $this->assertEquals('workflow.straight.guard', $events[2]); + $this->assertEquals('workflow.straight.guard.t1', $events[3]); + + $this->assertInstanceOf(LeaveEvent::class, $events[4]); + $this->assertEquals('workflow.leave', $events[5]); + $this->assertEquals('workflow.straight.leave', $events[6]); + $this->assertEquals('workflow.straight.leave.t1', $events[7]); + + $this->assertInstanceOf(TransitionEvent::class, $events[8]); + $this->assertEquals('workflow.transition', $events[9]); + $this->assertEquals('workflow.straight.transition', $events[10]); + $this->assertEquals('workflow.straight.transition.t1', $events[11]); + + $this->assertInstanceOf(EnterEvent::class, $events[12]); + $this->assertEquals('workflow.enter', $events[13]); + $this->assertEquals('workflow.straight.enter', $events[14]); + $this->assertEquals('workflow.straight.enter.t1', $events[15]); + + $this->assertInstanceOf(EnteredEvent::class, $events[16]); + $this->assertEquals('workflow.entered', $events[17]); + $this->assertEquals('workflow.straight.entered', $events[18]); + $this->assertEquals('workflow.straight.entered.t1', $events[19]); } } } namespace { + $events = null; function event($ev) From d16750ba2c3d6b5c1045a45f7dd770f8eed4b2fb Mon Sep 17 00:00:00 2001 From: Peter Smeets Date: Fri, 12 Jan 2018 16:27:51 +0100 Subject: [PATCH 61/83] Added completed event and fixed using of incorrect event names. --- src/Events/CompletedEvent.php | 8 ++++++++ src/Events/WorkflowSubscriber.php | 22 +++++++++++++++++++--- tests/WorkflowSubscriberTest.php | 20 +++++++++++++++++--- 3 files changed, 44 insertions(+), 6 deletions(-) create mode 100644 src/Events/CompletedEvent.php diff --git a/src/Events/CompletedEvent.php b/src/Events/CompletedEvent.php new file mode 100644 index 0000000..68d5dc4 --- /dev/null +++ b/src/Events/CompletedEvent.php @@ -0,0 +1,8 @@ +getWorkflowName() . '.leave', $event); - event('workflow.' . $event->getWorkflowName() . '.leave.' . $event->getTransition()->getName(), $event); + foreach ($event->getTransition()->getFroms() as $marking) { + event('workflow.' . $event->getWorkflowName() . '.leave.' . $marking, $event); + } } public function transitionEvent(Event $event) @@ -40,7 +42,9 @@ public function enterEvent(Event $event) event(new EnterEvent($event)); event('workflow.enter', $event); event('workflow.' . $event->getWorkflowName() . '.enter', $event); - event('workflow.' . $event->getWorkflowName() . '.enter.' . $event->getTransition()->getName(), $event); + foreach ($event->getTransition()->getTos() as $marking) { + event('workflow.' . $event->getWorkflowName() . '.enter.' . $marking, $event); + } } public function enteredEvent(Event $event) @@ -48,9 +52,20 @@ public function enteredEvent(Event $event) event(new EnteredEvent($event)); event('workflow.entered', $event); event('workflow.' . $event->getWorkflowName() . '.entered', $event); - event('workflow.' . $event->getWorkflowName() . '.entered.' . $event->getTransition()->getName(), $event); + foreach ($event->getTransition()->getTos() as $marking) { + event('workflow.' . $event->getWorkflowName() . '.entered.' . $marking, $event); + } } + public function completedEvent(Event $event) + { + event(new CompletedEvent($event)); + event('workflow.completed', $event); + event('workflow.' . $event->getWorkflowName() . '.completed', $event); + event('workflow.' . $event->getWorkflowName() . '.completed.' . $event->getTransition()->getName(), $event); + } + + public static function getSubscribedEvents() { return [ @@ -59,6 +74,7 @@ public static function getSubscribedEvents() 'workflow.transition' => ['transitionEvent'], 'workflow.enter' => ['enterEvent'], 'workflow.entered' => ['enteredEvent'], + 'workflow.completed' => ['completedEvent'], ]; } } diff --git a/tests/WorkflowSubscriberTest.php b/tests/WorkflowSubscriberTest.php index 830d0fb..9ee94cb 100644 --- a/tests/WorkflowSubscriberTest.php +++ b/tests/WorkflowSubscriberTest.php @@ -2,6 +2,8 @@ namespace Tests { + use Brexis\LaravelWorkflow\Events\AnnounceEvent; + use Brexis\LaravelWorkflow\Events\CompletedEvent; use Brexis\LaravelWorkflow\Events\EnteredEvent; use Brexis\LaravelWorkflow\Events\EnterEvent; use Brexis\LaravelWorkflow\Events\GuardEvent; @@ -42,6 +44,8 @@ public function testIfWorkflowEmitsEvents() $workflow->apply($object, 't1'); + $this->assertCount(28, $events); + $this->assertInstanceOf(GuardEvent::class, $events[0]); $this->assertEquals('workflow.guard', $events[1]); $this->assertEquals('workflow.straight.guard', $events[2]); @@ -50,7 +54,7 @@ public function testIfWorkflowEmitsEvents() $this->assertInstanceOf(LeaveEvent::class, $events[4]); $this->assertEquals('workflow.leave', $events[5]); $this->assertEquals('workflow.straight.leave', $events[6]); - $this->assertEquals('workflow.straight.leave.t1', $events[7]); + $this->assertEquals('workflow.straight.leave.a', $events[7]); $this->assertInstanceOf(TransitionEvent::class, $events[8]); $this->assertEquals('workflow.transition', $events[9]); @@ -60,12 +64,22 @@ public function testIfWorkflowEmitsEvents() $this->assertInstanceOf(EnterEvent::class, $events[12]); $this->assertEquals('workflow.enter', $events[13]); $this->assertEquals('workflow.straight.enter', $events[14]); - $this->assertEquals('workflow.straight.enter.t1', $events[15]); + $this->assertEquals('workflow.straight.enter.b', $events[15]); $this->assertInstanceOf(EnteredEvent::class, $events[16]); $this->assertEquals('workflow.entered', $events[17]); $this->assertEquals('workflow.straight.entered', $events[18]); - $this->assertEquals('workflow.straight.entered.t1', $events[19]); + $this->assertEquals('workflow.straight.entered.b', $events[19]); + + $this->assertInstanceOf(CompletedEvent::class, $events[20]); + $this->assertEquals('workflow.completed', $events[21]); + $this->assertEquals('workflow.straight.completed', $events[22]); + $this->assertEquals('workflow.straight.completed.t1', $events[23]); + + $this->assertInstanceOf(GuardEvent::class, $events[24]); + $this->assertEquals('workflow.guard', $events[25]); + $this->assertEquals('workflow.straight.guard', $events[26]); + $this->assertEquals('workflow.straight.guard.t2', $events[27]); } } } From 1125c196c012d1a3ed2c3b0fe4b897eed287fe2a Mon Sep 17 00:00:00 2001 From: Willem Oostendorp Date: Fri, 16 Feb 2018 11:27:50 +0100 Subject: [PATCH 62/83] Added Laravel 5.6 support --- composer.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 36093ce..0c8976d 100644 --- a/composer.json +++ b/composer.json @@ -8,8 +8,8 @@ "symfony/workflow": "^3.3", "symfony/process": "^3.3", "symfony/event-dispatcher": "^3.3", - "illuminate/console": "5.3.* | 5.4.* | 5.5.*", - "illuminate/support": "5.3.* | 5.4.* | 5.5.*" + "illuminate/console": "5.3.* | 5.4.* | 5.5.* | 5.6.*", + "illuminate/support": "5.3.* | 5.4.* | 5.5.* | 5.6.*" }, "autoload": { "psr-4": { @@ -36,6 +36,6 @@ }, "require-dev": { "mockery/mockery": "^0.9.8", - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^6.0|~7.0" } } From 7919123c3150da279a9fb6b94bd3803b69587b6a Mon Sep 17 00:00:00 2001 From: Willem Oostendorp Date: Fri, 16 Feb 2018 11:36:49 +0100 Subject: [PATCH 63/83] Updated the Symfony components to version >= 4.0 --- composer.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 0c8976d..0799295 100644 --- a/composer.json +++ b/composer.json @@ -5,9 +5,9 @@ "license": "MIT", "require": { "php": ">=5.5.9", - "symfony/workflow": "^3.3", - "symfony/process": "^3.3", - "symfony/event-dispatcher": "^3.3", + "symfony/workflow": "^4.0", + "symfony/process": "^4.0", + "symfony/event-dispatcher": "^4.0", "illuminate/console": "5.3.* | 5.4.* | 5.5.* | 5.6.*", "illuminate/support": "5.3.* | 5.4.* | 5.5.* | 5.6.*" }, From 03def8a2a124fa2225134489d273269e87213fbb Mon Sep 17 00:00:00 2001 From: Willem Oostendorp Date: Fri, 16 Feb 2018 11:54:25 +0100 Subject: [PATCH 64/83] Removed PHP 7.0 from the Travis config --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 7cc8e3a..1806132 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,6 @@ language: php php: - - 7.0 - 7.1 before_install: - sudo apt-get update -q From f614d5206e1c940badc5a9ddb57b305dd478894e Mon Sep 17 00:00:00 2001 From: Willem Oostendorp Date: Mon, 19 Feb 2018 16:01:36 +0100 Subject: [PATCH 65/83] Added support for older versions to be backwards compatible --- .travis.yml | 1 + composer.json | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1806132..7cc8e3a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,7 @@ language: php php: + - 7.0 - 7.1 before_install: - sudo apt-get update -q diff --git a/composer.json b/composer.json index 0799295..abc60e5 100644 --- a/composer.json +++ b/composer.json @@ -5,8 +5,8 @@ "license": "MIT", "require": { "php": ">=5.5.9", - "symfony/workflow": "^4.0", - "symfony/process": "^4.0", + "symfony/workflow": "^3.3 | ^4.0", + "symfony/process": "^3.3 | ^4.0", "symfony/event-dispatcher": "^4.0", "illuminate/console": "5.3.* | 5.4.* | 5.5.* | 5.6.*", "illuminate/support": "5.3.* | 5.4.* | 5.5.* | 5.6.*" @@ -36,6 +36,6 @@ }, "require-dev": { "mockery/mockery": "^0.9.8", - "phpunit/phpunit": "^6.0|~7.0" + "phpunit/phpunit": "^6.0 | ~7.0" } } From e4309c7d15b2506230f3cbe17bac5c494497c503 Mon Sep 17 00:00:00 2001 From: Willem Oostendorp Date: Mon, 19 Feb 2018 16:02:52 +0100 Subject: [PATCH 66/83] Changed the single pipes to double pipes as the single pipes are deprecated --- composer.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index abc60e5..59c0f3f 100644 --- a/composer.json +++ b/composer.json @@ -5,11 +5,11 @@ "license": "MIT", "require": { "php": ">=5.5.9", - "symfony/workflow": "^3.3 | ^4.0", - "symfony/process": "^3.3 | ^4.0", + "symfony/workflow": "^3.3 || ^4.0", + "symfony/process": "^3.3 || ^4.0", "symfony/event-dispatcher": "^4.0", - "illuminate/console": "5.3.* | 5.4.* | 5.5.* | 5.6.*", - "illuminate/support": "5.3.* | 5.4.* | 5.5.* | 5.6.*" + "illuminate/console": "5.3.* || 5.4.* || 5.5.* || 5.6.*", + "illuminate/support": "5.3.* || 5.4.* || 5.5.* || 5.6.*" }, "autoload": { "psr-4": { @@ -36,6 +36,6 @@ }, "require-dev": { "mockery/mockery": "^0.9.8", - "phpunit/phpunit": "^6.0 | ~7.0" + "phpunit/phpunit": "^6.0 || ~7.0" } } From 105473abcd880cfeb61a8d3da1522b45f52b0557 Mon Sep 17 00:00:00 2001 From: Willem Oostendorp Date: Mon, 19 Feb 2018 16:08:26 +0100 Subject: [PATCH 67/83] Added missing older version for the symfony/event-dispatcher package --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 59c0f3f..258c9e2 100644 --- a/composer.json +++ b/composer.json @@ -7,7 +7,7 @@ "php": ">=5.5.9", "symfony/workflow": "^3.3 || ^4.0", "symfony/process": "^3.3 || ^4.0", - "symfony/event-dispatcher": "^4.0", + "symfony/event-dispatcher": "^3.3 || ^4.0", "illuminate/console": "5.3.* || 5.4.* || 5.5.* || 5.6.*", "illuminate/support": "5.3.* || 5.4.* || 5.5.* || 5.6.*" }, From 2af9388cb58452fc704d80c5941f77761e7c5859 Mon Sep 17 00:00:00 2001 From: Willem Oostendorp Date: Mon, 19 Feb 2018 16:36:29 +0100 Subject: [PATCH 68/83] Fixed some typos and styling issues --- src/WorkflowRegistry.php | 78 ++++++++++++++++++++++------------------ 1 file changed, 44 insertions(+), 34 deletions(-) diff --git a/src/WorkflowRegistry.php b/src/WorkflowRegistry.php index ba4f0cc..44231ea 100644 --- a/src/WorkflowRegistry.php +++ b/src/WorkflowRegistry.php @@ -11,6 +11,7 @@ use Symfony\Component\Workflow\MarkingStore\SingleStateMarkingStore; use Symfony\Component\Workflow\Registry; use Symfony\Component\Workflow\StateMachine; +use Symfony\Component\Workflow\SupportStrategy\SupportStrategyInterface; use Symfony\Component\Workflow\Transition; use Symfony\Component\Workflow\Workflow; use Symfony\Component\Workflow\SupportStrategy\ClassInstanceSupportStrategy; @@ -21,7 +22,7 @@ class WorkflowRegistry { /** - * @var Symfony\Component\Workflow\Registry + * @var Registry */ private $registry; @@ -35,13 +36,19 @@ class WorkflowRegistry */ private $dispatcher; + /** + * WorkflowRegistry constructor + * + * @param array $config + * @throws \ReflectionException + */ public function __construct(array $config) { - $this->registry = new Registry(); - $this->config = $config; - $this->dispatcher = new EventDispatcher(); + $this->registry = new Registry(); + $this->config = $config; + $this->dispatcher = new EventDispatcher(); - $subscriber = new WorkflowSubscriber(); + $subscriber = new WorkflowSubscriber(); $this->dispatcher->addSubscriber($subscriber); foreach ($this->config as $name => $workflowData) { @@ -55,9 +62,9 @@ public function __construct(array $config) $builder->addTransition(new Transition($transitionName, $transition['from'], $transition['to'])); } - $definition = $builder->build(); - $markingStore = $this->getMakingStoreInstance($workflowData); - $workflow = $this->getWorkflowInstance($name, $workflowData, $definition, $markingStore); + $definition = $builder->build(); + $markingStore = $this->getMarkingStoreInstance($workflowData); + $workflow = $this->getWorkflowInstance($name, $workflowData, $definition, $markingStore); foreach ($workflowData['supports'] as $supportedClass) { $this->add($workflow, $supportedClass); @@ -66,7 +73,8 @@ public function __construct(array $config) } /** - * Return the $subject workflo + * Return the $subject workflow + * * @param object $subject * @param string $workflowName * @return Workflow @@ -78,31 +86,36 @@ public function get($subject, $workflowName = null) /** * Add a workflow to the subject - * @param Workflow $workflow - * @param Symfony\Component\Workflow\SupportStrategy\SupportStrategyInterface $supportStrategy + * + * @param Workflow $workflow + * @param SupportStrategyInterface $supportStrategy */ - public function add(Workflow $workflow, $supportStrategy) + public function add(Workflow $workflow, SupportStrategyInterface $supportStrategy) { - return $this->registry->add($workflow, new ClassInstanceSupportStrategy($supportStrategy)); + $this->registry->add($workflow, new ClassInstanceSupportStrategy($supportStrategy)); } /** * Return the workflow instance * - * @param String $name - * @param array $workflowData - * @param Symfony\Component\Workflow\Definition $definition - * @param Symfony\Component\Workflow\MarkingStore\MarkingStoreInterface $makingStore - * @return Symfony\Component\Workflow\Workflow + * @param String $name + * @param array $workflowData + * @param Definition $definition + * @param MarkingStoreInterface $markingStore + * @return Workflow */ - private function getWorkflowInstance($name, $workflowData, Definition $definition, MarkingStoreInterface $markingStore) - { + private function getWorkflowInstance( + $name, + array $workflowData, + Definition $definition, + MarkingStoreInterface $markingStore + ) { $type = isset($workflowData['type']) ? $workflowData['type'] : 'workflow'; $className = Workflow::class; if ($type === 'state_machine') { $className = StateMachine::class; - } else if (isset($workflowData['class'])) { + } elseif (isset($workflowData['class'])) { $className = $workflowData['class']; } @@ -112,24 +125,21 @@ private function getWorkflowInstance($name, $workflowData, Definition $definitio /** * Return the making store instance * - * @param array $makingStoreData - * @return Symfony\Component\Workflow\MarkingStore\MarkingStoreInterface + * @param array $workflowData + * @return MarkingStoreInterface + * @throws \ReflectionException */ - private function getMakingStoreInstance($workflowData) + private function getMarkingStoreInstance(array $workflowData) { - $makingStoreData = isset($workflowData['marking_store']) ? $workflowData['marking_store'] : []; - $type = isset($makingStoreData['type']) ? $makingStoreData['type'] : 'single_state'; - $className = SingleStateMarkingStore::class; - $arguments = []; + $markingStoreData = isset($workflowData['marking_store']) ? $workflowData['marking_store'] : []; + $type = isset($markingStoreData['type']) ? $markingStoreData['type'] : 'single_state'; + $className = SingleStateMarkingStore::class; + $arguments = isset($markingStoreData['arguments']) ? $markingStoreData['arguments'] : []; if ($type === 'multiple_state') { $className = MultipleStateMarkingStore::class; - } else if (isset($workflowData['class'])) { - $className = $workflowData['class']; - } - - if (isset($makingStoreData['arguments'])) { - $arguments = $makingStoreData['arguments']; + } elseif (isset($markingStoreData['class'])) { + $className = $markingStoreData['class']; } $class = new \ReflectionClass($className); From 08a8126610b3ba2932644f37fed3938b6b4b5596 Mon Sep 17 00:00:00 2001 From: Willem Oostendorp Date: Mon, 19 Feb 2018 16:39:54 +0100 Subject: [PATCH 69/83] Added the addFromArray method to allow dynamically adding workflows to the registry --- src/WorkflowRegistry.php | 46 +++++++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/src/WorkflowRegistry.php b/src/WorkflowRegistry.php index 44231ea..c599ab2 100644 --- a/src/WorkflowRegistry.php +++ b/src/WorkflowRegistry.php @@ -52,23 +52,7 @@ public function __construct(array $config) $this->dispatcher->addSubscriber($subscriber); foreach ($this->config as $name => $workflowData) { - $builder = new DefinitionBuilder($workflowData['places']); - - foreach ($workflowData['transitions'] as $transitionName => $transition) { - if (!is_string($transitionName)) { - $transitionName = $transition['name']; - } - - $builder->addTransition(new Transition($transitionName, $transition['from'], $transition['to'])); - } - - $definition = $builder->build(); - $markingStore = $this->getMarkingStoreInstance($workflowData); - $workflow = $this->getWorkflowInstance($name, $workflowData, $definition, $markingStore); - - foreach ($workflowData['supports'] as $supportedClass) { - $this->add($workflow, $supportedClass); - } + $this->addFromArray($name, $workflowData); } } @@ -95,6 +79,34 @@ public function add(Workflow $workflow, SupportStrategyInterface $supportStrateg $this->registry->add($workflow, new ClassInstanceSupportStrategy($supportStrategy)); } + /** + * Add a workflow to the registry from array + * + * @param string $name + * @param array $workflowData + * @throws \ReflectionException + */ + public function addFromArray($name, array $workflowData) + { + $builder = new DefinitionBuilder($workflowData['places']); + + foreach ($workflowData['transitions'] as $transitionName => $transition) { + if (!is_string($transitionName)) { + $transitionName = $transition['name']; + } + + $builder->addTransition(new Transition($transitionName, $transition['from'], $transition['to'])); + } + + $definition = $builder->build(); + $markingStore = $this->getMarkingStoreInstance($workflowData); + $workflow = $this->getWorkflowInstance($name, $workflowData, $definition, $markingStore); + + foreach ($workflowData['supports'] as $supportedClass) { + $this->add($workflow, $supportedClass); + } + } + /** * Return the workflow instance * From c23de9448629540b4880f204dcd6c05162ab8ba0 Mon Sep 17 00:00:00 2001 From: Willem Oostendorp Date: Mon, 19 Feb 2018 17:00:34 +0100 Subject: [PATCH 70/83] Fixed some styling issues and made all private methods and properties protected to allow subclassing of the registry class --- src/WorkflowRegistry.php | 49 ++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/src/WorkflowRegistry.php b/src/WorkflowRegistry.php index c599ab2..5628c31 100644 --- a/src/WorkflowRegistry.php +++ b/src/WorkflowRegistry.php @@ -24,17 +24,17 @@ class WorkflowRegistry /** * @var Registry */ - private $registry; + protected $registry; /** * @var array */ - private $config; + protected $config; /** * @var EventDispatcher */ - private $dispatcher; + protected $dispatcher; /** * WorkflowRegistry constructor @@ -44,11 +44,11 @@ class WorkflowRegistry */ public function __construct(array $config) { - $this->registry = new Registry(); - $this->config = $config; + $this->registry = new Registry(); + $this->config = $config; $this->dispatcher = new EventDispatcher(); - $subscriber = new WorkflowSubscriber(); + $subscriber = new WorkflowSubscriber(); $this->dispatcher->addSubscriber($subscriber); foreach ($this->config as $name => $workflowData) { @@ -71,10 +71,10 @@ public function get($subject, $workflowName = null) /** * Add a workflow to the subject * - * @param Workflow $workflow - * @param SupportStrategyInterface $supportStrategy + * @param Workflow $workflow + * @param string $supportStrategy */ - public function add(Workflow $workflow, SupportStrategyInterface $supportStrategy) + public function add(Workflow $workflow, $supportStrategy) { $this->registry->add($workflow, new ClassInstanceSupportStrategy($supportStrategy)); } @@ -98,9 +98,9 @@ public function addFromArray($name, array $workflowData) $builder->addTransition(new Transition($transitionName, $transition['from'], $transition['to'])); } - $definition = $builder->build(); + $definition = $builder->build(); $markingStore = $this->getMarkingStoreInstance($workflowData); - $workflow = $this->getWorkflowInstance($name, $workflowData, $definition, $markingStore); + $workflow = $this->getWorkflowInstance($name, $workflowData, $definition, $markingStore); foreach ($workflowData['supports'] as $supportedClass) { $this->add($workflow, $supportedClass); @@ -116,19 +116,18 @@ public function addFromArray($name, array $workflowData) * @param MarkingStoreInterface $markingStore * @return Workflow */ - private function getWorkflowInstance( + protected function getWorkflowInstance( $name, array $workflowData, Definition $definition, MarkingStoreInterface $markingStore ) { - $type = isset($workflowData['type']) ? $workflowData['type'] : 'workflow'; - $className = Workflow::class; - - if ($type === 'state_machine') { - $className = StateMachine::class; - } elseif (isset($workflowData['class'])) { + if (isset($workflowData['class'])) { $className = $workflowData['class']; + } elseif (isset($workflowData['type']) && $workflowData['type'] === 'state_machine') { + $className = StateMachine::class; + } else { + $className = Workflow::class; } return new $className($definition, $markingStore, $this->dispatcher, $name); @@ -141,17 +140,17 @@ private function getWorkflowInstance( * @return MarkingStoreInterface * @throws \ReflectionException */ - private function getMarkingStoreInstance(array $workflowData) + protected function getMarkingStoreInstance(array $workflowData) { $markingStoreData = isset($workflowData['marking_store']) ? $workflowData['marking_store'] : []; - $type = isset($markingStoreData['type']) ? $markingStoreData['type'] : 'single_state'; - $className = SingleStateMarkingStore::class; - $arguments = isset($markingStoreData['arguments']) ? $markingStoreData['arguments'] : []; + $arguments = isset($markingStoreData['arguments']) ? $markingStoreData['arguments'] : []; - if ($type === 'multiple_state') { - $className = MultipleStateMarkingStore::class; - } elseif (isset($markingStoreData['class'])) { + if (isset($markingStoreData['class'])) { $className = $markingStoreData['class']; + } elseif (isset($markingStoreData['type']) && $markingStoreData['type'] === 'multiple_state') { + $className = MultipleStateMarkingStore::class; + } else { + $className = SingleStateMarkingStore::class; } $class = new \ReflectionClass($className); From 6b3ed273a99d21a614b453f2b541dfa1949fb448 Mon Sep 17 00:00:00 2001 From: Willem Oostendorp Date: Mon, 19 Feb 2018 17:01:01 +0100 Subject: [PATCH 71/83] Removed unused use clause --- src/WorkflowRegistry.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/WorkflowRegistry.php b/src/WorkflowRegistry.php index 5628c31..d27ff5a 100644 --- a/src/WorkflowRegistry.php +++ b/src/WorkflowRegistry.php @@ -11,10 +11,9 @@ use Symfony\Component\Workflow\MarkingStore\SingleStateMarkingStore; use Symfony\Component\Workflow\Registry; use Symfony\Component\Workflow\StateMachine; -use Symfony\Component\Workflow\SupportStrategy\SupportStrategyInterface; +use Symfony\Component\Workflow\SupportStrategy\ClassInstanceSupportStrategy; use Symfony\Component\Workflow\Transition; use Symfony\Component\Workflow\Workflow; -use Symfony\Component\Workflow\SupportStrategy\ClassInstanceSupportStrategy; /** * @author Boris Koumondji From e0403ea70cdaed6f0a388fae49a2230878f690a8 Mon Sep 17 00:00:00 2001 From: Boris KOUMONDJI Date: Tue, 20 Feb 2018 12:20:07 +0100 Subject: [PATCH 72/83] Refactor event subscriptions --- src/Events/CompletedEvent.php | 7 +++-- src/Events/EnterEvent.php | 1 + src/Events/EnteredEvent.php | 1 + src/Events/LeaveEvent.php | 1 + src/Events/TransitionEvent.php | 1 + src/Events/WorkflowSubscriber.php | 52 +++++++++++++++++++++---------- 6 files changed, 45 insertions(+), 18 deletions(-) diff --git a/src/Events/CompletedEvent.php b/src/Events/CompletedEvent.php index 68d5dc4..2c03b33 100644 --- a/src/Events/CompletedEvent.php +++ b/src/Events/CompletedEvent.php @@ -2,7 +2,10 @@ namespace Brexis\LaravelWorkflow\Events; +/** + * @author Peter Sweets + */ class CompletedEvent extends BaseEvent { - -} \ No newline at end of file + // +} diff --git a/src/Events/EnterEvent.php b/src/Events/EnterEvent.php index 172ae3e..7b46338 100644 --- a/src/Events/EnterEvent.php +++ b/src/Events/EnterEvent.php @@ -7,4 +7,5 @@ */ class EnterEvent extends BaseEvent { + // } diff --git a/src/Events/EnteredEvent.php b/src/Events/EnteredEvent.php index 39774d9..d191f5e 100644 --- a/src/Events/EnteredEvent.php +++ b/src/Events/EnteredEvent.php @@ -7,4 +7,5 @@ */ class EnteredEvent extends BaseEvent { + // } diff --git a/src/Events/LeaveEvent.php b/src/Events/LeaveEvent.php index 96b04a7..ed0803f 100644 --- a/src/Events/LeaveEvent.php +++ b/src/Events/LeaveEvent.php @@ -7,4 +7,5 @@ */ class LeaveEvent extends BaseEvent { + // } diff --git a/src/Events/TransitionEvent.php b/src/Events/TransitionEvent.php index 5ecfb4d..b44b591 100644 --- a/src/Events/TransitionEvent.php +++ b/src/Events/TransitionEvent.php @@ -7,4 +7,5 @@ */ class TransitionEvent extends BaseEvent { + // } diff --git a/src/Events/WorkflowSubscriber.php b/src/Events/WorkflowSubscriber.php index 7921835..75e8fb7 100644 --- a/src/Events/WorkflowSubscriber.php +++ b/src/Events/WorkflowSubscriber.php @@ -13,59 +13,79 @@ class WorkflowSubscriber implements EventSubscriberInterface { public function guardEvent(SymfonyGuardEvent $event) { + $workflowName = $event->getWorkflowName(); + $transitionName = $event->getTransition()->getName(); + event(new GuardEvent($event)); event('workflow.guard', $event); - event('workflow.' . $event->getWorkflowName() . '.guard', $event); - event('workflow.' . $event->getWorkflowName() . '.guard.' . $event->getTransition()->getName(), $event); + event(sprintf('workflow.%s.guard', $workflowName), $event); + event(sprintf('workflow.%s.guard.%s', $workflowName, $transitionName), $event); } public function leaveEvent(Event $event) { + $places = $event->getTransition()->getFroms(); + $workflowName = $event->getWorkflowName(); + event(new LeaveEvent($event)); event('workflow.leave', $event); - event('workflow.' . $event->getWorkflowName() . '.leave', $event); - foreach ($event->getTransition()->getFroms() as $marking) { - event('workflow.' . $event->getWorkflowName() . '.leave.' . $marking, $event); + event(sprintf('workflow.%s.leave', $workflowName), $event); + + foreach ($places as $place) { + event(sprintf('workflow.%s.leave.%s', $workflowName, $place), $event); } } public function transitionEvent(Event $event) { + $workflowName = $event->getWorkflowName(); + $transitionName = $event->getTransition()->getName(); + event(new TransitionEvent($event)); event('workflow.transition', $event); - event('workflow.' . $event->getWorkflowName() . '.transition', $event); - event('workflow.' . $event->getWorkflowName() . '.transition.' . $event->getTransition()->getName(), $event); + event(sprintf('workflow.%s.transition', $workflowName), $event); + event(sprintf('workflow.%s.transition.%s', $workflowName, $transitionName), $event); } public function enterEvent(Event $event) { + $places = $event->getTransition()->getTos(); + $workflowName = $event->getWorkflowName(); + event(new EnterEvent($event)); event('workflow.enter', $event); - event('workflow.' . $event->getWorkflowName() . '.enter', $event); - foreach ($event->getTransition()->getTos() as $marking) { - event('workflow.' . $event->getWorkflowName() . '.enter.' . $marking, $event); + event(sprintf('workflow.%s.enter', $workflowName), $event); + + foreach ($places as $place) { + event(sprintf('workflow.%s.enter.%s', $workflowName, $place), $event); } } public function enteredEvent(Event $event) { + $places = $event->getTransition()->getTos(); + $workflowName = $event->getWorkflowName(); + event(new EnteredEvent($event)); event('workflow.entered', $event); - event('workflow.' . $event->getWorkflowName() . '.entered', $event); - foreach ($event->getTransition()->getTos() as $marking) { - event('workflow.' . $event->getWorkflowName() . '.entered.' . $marking, $event); + event(sprintf('workflow.%s.entered', $workflowName), $event); + + foreach ($places as $place) { + event(sprintf('workflow.%s.entered.%s', $workflowName, $place), $event); } } public function completedEvent(Event $event) { + $workflowName = $event->getWorkflowName(); + $transitionName = $event->getTransition()->getName(); + event(new CompletedEvent($event)); event('workflow.completed', $event); - event('workflow.' . $event->getWorkflowName() . '.completed', $event); - event('workflow.' . $event->getWorkflowName() . '.completed.' . $event->getTransition()->getName(), $event); + event(sprintf('workflow.%s.completed', $workflowName), $event); + event(sprintf('workflow.%s.completed.%s', $workflowName, $transitionName), $event); } - public static function getSubscribedEvents() { return [ From cbd47a8584a6020981c67833187de690685de414 Mon Sep 17 00:00:00 2001 From: Boris KOUMONDJI Date: Tue, 20 Feb 2018 12:31:41 +0100 Subject: [PATCH 73/83] Enable php 7.2 unit tests in travis --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 7cc8e3a..1d0b152 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,7 @@ language: php php: - 7.0 - 7.1 + - 7.2 before_install: - sudo apt-get update -q - sudo apt-get autoremove graphviz -y From b982bedda1b4d492af24a9a009bc7c4593e7ac7c Mon Sep 17 00:00:00 2001 From: vlsoprun Date: Tue, 13 Mar 2018 03:57:48 +0300 Subject: [PATCH 74/83] #21 Does not work multiple "from" --- src/WorkflowRegistry.php | 4 +++- tests/WorkflowRegistryTest.php | 40 ++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/src/WorkflowRegistry.php b/src/WorkflowRegistry.php index d27ff5a..0e87d76 100644 --- a/src/WorkflowRegistry.php +++ b/src/WorkflowRegistry.php @@ -94,7 +94,9 @@ public function addFromArray($name, array $workflowData) $transitionName = $transition['name']; } - $builder->addTransition(new Transition($transitionName, $transition['from'], $transition['to'])); + foreach ((array)$transition['from'] as $form) { + $builder->addTransition(new Transition($transitionName, $form, $transition['to'])); + } } $definition = $builder->build(); diff --git a/tests/WorkflowRegistryTest.php b/tests/WorkflowRegistryTest.php index 91e12b5..6a43c11 100644 --- a/tests/WorkflowRegistryTest.php +++ b/tests/WorkflowRegistryTest.php @@ -125,4 +125,44 @@ public function testIfTransitionsWithSameNameCanBothBeUsed() $this->assertTrue($workflow->can($subject, 't1')); } + + public function testWhenMultipleFromIsUsed() + { + $config = [ + 'straight' => [ + 'type' => 'state_machine', + 'supports' => ['Tests\Fixtures\TestObject'], + 'places' => ['a', 'b', 'c'], + 'transitions' => [ + [ + 'name' => 't1', + 'from' => 'a', + 'to' => 'b', + ], + [ + 'name' => 't2', + 'from' => [ + 'a', + 'b' + ], + 'to' => 'c', + ], + ], + ], + ]; + + $registry = new WorkflowRegistry($config); + $subject = new TestObject; + $workflow = $registry->get($subject); + + $markingStoreProp = new ReflectionProperty(Workflow::class, 'markingStore'); + $markingStoreProp->setAccessible(true); + + $markingStore = $markingStoreProp->getValue($workflow); + + $this->assertTrue($workflow instanceof StateMachine); + $this->assertTrue($markingStore instanceof SingleStateMarkingStore); + $this->assertTrue($workflow->can($subject, 't1')); + $this->assertTrue($workflow->can($subject, 't2')); + } } From 096dd041c51103c15ff977e8efeedb452a425a70 Mon Sep 17 00:00:00 2001 From: Lucas Guima Date: Tue, 24 Apr 2018 10:49:25 -0300 Subject: [PATCH 75/83] Adds usage of GuardEvent class Adds usage of GuardEvent class from package --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index cd49f2a..e97fda5 100644 --- a/README.md +++ b/README.md @@ -134,6 +134,8 @@ You can subscribe to an event namespace App\Listeners; +use Brexis\LaravelWorkflow\Events\GuardEvent; + class BlogPostWorkflowSubscriber { /** From b38e386567ccbc0d9823ec729388e27c84d2600a Mon Sep 17 00:00:00 2001 From: Lucas Guima Date: Wed, 9 May 2018 10:37:35 -0300 Subject: [PATCH 76/83] Adds usage of classes Adds usage of classes on example --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index e97fda5..b64161b 100644 --- a/README.md +++ b/README.md @@ -89,6 +89,9 @@ class BlogPost extends Model ```php Date: Wed, 9 May 2018 15:03:34 -0300 Subject: [PATCH 77/83] Update usage of Workflow Update usage of Workflow --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b64161b..1ab58ba 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,7 @@ class BlogPost extends Model Date: Wed, 13 Jun 2018 12:23:28 +0100 Subject: [PATCH 78/83] Add more unit test for dump command --- phpunit.xml | 3 +- src/Commands/WorkflowDumpCommand.php | 3 +- tests/WorkflowDumpCommandTest.php | 42 ++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+), 3 deletions(-) diff --git a/phpunit.xml b/phpunit.xml index 9cb3cb2..da28f90 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -8,8 +8,7 @@ convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" - stopOnFailure="false" - syntaxCheck="false"> + stopOnFailure="false"> ./tests diff --git a/src/Commands/WorkflowDumpCommand.php b/src/Commands/WorkflowDumpCommand.php index b61087e..fa008e1 100644 --- a/src/Commands/WorkflowDumpCommand.php +++ b/src/Commands/WorkflowDumpCommand.php @@ -50,7 +50,8 @@ public function handle() } if (false === array_search($class, $config[$workflowName]['supports'])) { - throw new Exception("Workflow $workflowName has no support for class $class"); + throw new Exception("Workflow $workflowName has no support for class $class.". + ' Please specify a valid support class with the --class option.'); } $subject = new $class; diff --git a/tests/WorkflowDumpCommandTest.php b/tests/WorkflowDumpCommandTest.php index eec75cc..7b1ea1e 100644 --- a/tests/WorkflowDumpCommandTest.php +++ b/tests/WorkflowDumpCommandTest.php @@ -7,6 +7,48 @@ class WorkflowDumpCommandTest extends TestCase { + public function testShouldThrowExceptionForUndefinedWorkflow() + { + $command = Mockery::mock(WorkflowDumpCommand::class) + ->makePartial() + ->shouldReceive('argument') + ->with('workflow') + ->andReturn('fake') + ->shouldReceive('option') + ->with('format') + ->andReturn('png') + ->shouldReceive('option') + ->with('class') + ->andReturn('Tests\Fixtures\TestObject') + ->getMock(); + + $this->expectException(\Exception::class); + $this->expectExceptionMessage('Workflow fake is not configured.'); + $command->handle(); + } + + public function testShouldThrowExceptionForUndefinedClass() + { + $command = Mockery::mock(WorkflowDumpCommand::class) + ->makePartial() + ->shouldReceive('argument') + ->with('workflow') + ->andReturn('straight') + ->shouldReceive('option') + ->with('format') + ->andReturn('png') + ->shouldReceive('option') + ->with('class') + ->andReturn('Tests\Fixtures\FakeObject') + ->getMock(); + + $this->expectException(\Exception::class); + $this->expectExceptionMessage('Workflow straight has no support for'. + ' class Tests\Fixtures\FakeObject. Please specify a valid support'. + ' class with the --class option.'); + $command->handle(); + } + public function testWorkflowCommand() { if (file_exists('straight.png')) { From 7f4d71522f80a6e42a2e0b032e40f49351a61b03 Mon Sep 17 00:00:00 2001 From: Boris KOUMONDJI Date: Wed, 13 Jun 2018 12:25:35 +0100 Subject: [PATCH 79/83] Document --class option --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1ab58ba..c152a9c 100644 --- a/README.md +++ b/README.md @@ -217,7 +217,7 @@ class BlogPostWorkflowSubscriber ### Dump Workflows Symfony workflow uses GraphvizDumper to create the workflow image. You may need to install the `dot` command of [Graphviz](http://www.graphviz.org/) - php artisan workflow:dump workflow_name + php artisan workflow:dump workflow_name --class App\\BlogPost You can change the image format with the `--format` option. By default the format is png. From d5b6ebd380784e14adafb160e0d3a873a7458932 Mon Sep 17 00:00:00 2001 From: Boris KOUMONDJI Date: Wed, 25 Jul 2018 20:05:19 +0100 Subject: [PATCH 80/83] Fix auto discover issue --- config/{config.php => workflow.php} | 0 src/WorkflowServiceProvider.php | 7 ++++++- 2 files changed, 6 insertions(+), 1 deletion(-) rename config/{config.php => workflow.php} (100%) diff --git a/config/config.php b/config/workflow.php similarity index 100% rename from config/config.php rename to config/workflow.php diff --git a/src/WorkflowServiceProvider.php b/src/WorkflowServiceProvider.php index 0fec9b3..c4b8b97 100644 --- a/src/WorkflowServiceProvider.php +++ b/src/WorkflowServiceProvider.php @@ -32,11 +32,16 @@ public function boot() */ public function register() { + $this->mergeConfigFrom( + __DIR__.'/../config/workflow.php', + 'workflow' + ); + $this->commands($this->commands); $this->app->singleton( 'workflow', function ($app) { - return new WorkflowRegistry($app['config']['workflow']); + return new WorkflowRegistry($app['config']->get('workflow')); } ); } From 3f16611d64ff1b01334761797511953d4aa6cc93 Mon Sep 17 00:00:00 2001 From: Boris KOUMONDJI Date: Wed, 25 Jul 2018 20:28:41 +0100 Subject: [PATCH 81/83] Fix config path --- src/WorkflowServiceProvider.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/WorkflowServiceProvider.php b/src/WorkflowServiceProvider.php index c4b8b97..51a7e52 100644 --- a/src/WorkflowServiceProvider.php +++ b/src/WorkflowServiceProvider.php @@ -20,9 +20,11 @@ class WorkflowServiceProvider extends ServiceProvider */ public function boot() { - $configPath = __DIR__ . '/../config/config.php'; + $configPath = $this->configPath(); - $this->publishes([$configPath => config_path('workflow.php')], 'config'); + $this->publishes([ + $configPath => config_path('workflow.php') + ], 'config'); } /** @@ -33,7 +35,7 @@ public function boot() public function register() { $this->mergeConfigFrom( - __DIR__.'/../config/workflow.php', + $this->configPath(), 'workflow' ); @@ -46,6 +48,11 @@ public function register() ); } + protected function configPath() + { + return __DIR__ . '/../config/workflow.php'; + } + /** * Get the services provided by the provider. * From 8ba70085de642c5caad5a17692e002cfe6a6d228 Mon Sep 17 00:00:00 2001 From: Willem Oostendorp Date: Thu, 8 Nov 2018 15:30:02 +0100 Subject: [PATCH 82/83] Update Illuminate packages to v5.7.* --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 258c9e2..f4be66d 100644 --- a/composer.json +++ b/composer.json @@ -8,8 +8,8 @@ "symfony/workflow": "^3.3 || ^4.0", "symfony/process": "^3.3 || ^4.0", "symfony/event-dispatcher": "^3.3 || ^4.0", - "illuminate/console": "5.3.* || 5.4.* || 5.5.* || 5.6.*", - "illuminate/support": "5.3.* || 5.4.* || 5.5.* || 5.6.*" + "illuminate/console": "5.3.* || 5.4.* || 5.5.* || 5.6.* || 5.7.*", + "illuminate/support": "5.3.* || 5.4.* || 5.5.* || 5.6.* || 5.7.*" }, "autoload": { "psr-4": { From 924c14ed57d00d884b9ae6f6d23d7301329e4baa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=BB=D0=B0=D0=B4=D0=B8=D1=81=D0=BB=D0=B0=D0=B2?= Date: Tue, 23 Apr 2019 16:01:27 +0300 Subject: [PATCH 83/83] Update composer.json Update illuminate to 5.8 --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index f4be66d..cfda9b1 100644 --- a/composer.json +++ b/composer.json @@ -8,8 +8,8 @@ "symfony/workflow": "^3.3 || ^4.0", "symfony/process": "^3.3 || ^4.0", "symfony/event-dispatcher": "^3.3 || ^4.0", - "illuminate/console": "5.3.* || 5.4.* || 5.5.* || 5.6.* || 5.7.*", - "illuminate/support": "5.3.* || 5.4.* || 5.5.* || 5.6.* || 5.7.*" + "illuminate/console": "5.3.* || 5.4.* || 5.5.* || 5.6.* || 5.7.* || 5.8.*", + "illuminate/support": "5.3.* || 5.4.* || 5.5.* || 5.6.* || 5.7.* || 5.8.*" }, "autoload": { "psr-4": {