-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
4,535 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
* text=auto | ||
|
||
/.codecov.yml export-ignore | ||
/.gitattributes export-ignore | ||
/.gitignore export-ignore | ||
/.php_cs.dist export-ignore | ||
/buddy.yml export-ignore | ||
/phpunit.xml.dist export-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/vendor/ | ||
.phpunit.cache | ||
phpunit.xml | ||
.php_cs.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
$finder = PhpCsFixer\Finder::create() | ||
->in(__DIR__.'/src') | ||
->in(__DIR__.'/tests') | ||
; | ||
|
||
return PhpCsFixer\Config::create() | ||
->setRiskyAllowed(true) | ||
->setRules([ | ||
'@PHP71Migration' => true, | ||
'@Symfony' => true, | ||
'array_syntax' => ['syntax' => 'short'], | ||
'no_superfluous_elseif' => true, | ||
'no_superfluous_phpdoc_tags' => ['allow_mixed' => true], | ||
'no_unreachable_default_argument_value' => true, | ||
'no_useless_else' => true, | ||
'no_useless_return' => true, | ||
'no_unused_imports' => true, | ||
'declare_strict_types' => true, | ||
'ordered_imports' => [ | ||
'importsOrder' => null, | ||
'sortAlgorithm' => 'alpha', | ||
], | ||
'phpdoc_order' => true, | ||
'phpdoc_align' => true, | ||
'phpdoc_no_access' => true, | ||
'phpdoc_separation' => true, | ||
'pre_increment' => true, | ||
'single_quote' => true, | ||
'trim_array_spaces' => true, | ||
'single_blank_line_before_namespace' => true, | ||
'yoda_style' => null, | ||
'global_namespace_import' => [ | ||
'import_classes' => false, | ||
'import_constants' => false, | ||
'import_functions' => false | ||
], | ||
// risky --> | ||
'strict_param' => true, | ||
]) | ||
->setFinder($finder) | ||
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2021 Arkadiusz Kondas <arkadiusz.kondas[at]gmail> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Exspecto | ||
|
||
[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%207.4-8892BF.svg)](https://php.net/) | ||
|
||
Small PHP DSL for synchronizing asynchronous operations (busy-waiting). | ||
|
||
A simple and useful library recommended especially for testing asynchronous systems. | ||
Exspecto allows you to express expectations of an asynchronous system in a concise and easy to read manner. Example: | ||
|
||
```php | ||
await()->atMost(1)->until(function() { | ||
return customerStatusIsUpdated(); | ||
}); | ||
``` | ||
|
||
You can use `pollInterval` to set how often the condition should be checked (default value is 100 milliseconds): | ||
|
||
```php | ||
await()->atMost(3)->pollInterval(200)->until(function() { | ||
return customerStatusIsUpdated(); | ||
}); | ||
``` | ||
|
||
--- | ||
|
||
*exspecto* - from latin: *wait for*, *await* | ||
|
||
## Install | ||
|
||
```shell | ||
composer require akondas/exspecto | ||
``` | ||
|
||
## Roadmap | ||
|
||
- [ ] `untilAsserted` for example: `untilAsserted('UserRepository::size', equaltTo(3))` | ||
- [ ] support different poll interval strategy (fixed, fibonacci, iterative) | ||
- [ ] `ignoreExceptions` do not stop when exceptions occur (`ignoreException(string $exceptionClass)`) | ||
- [ ] `atLeast` | ||
- [ ] `unitlNotNull`, `untilNull` etc. | ||
|
||
## License | ||
|
||
Exspecto is released under the MIT Licence. See the bundled LICENSE file for details. | ||
|
||
## Author | ||
|
||
Arkadiusz Kondas (@ArkadiuszKondas) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
{ | ||
"name": "akondas/exspecto", | ||
"type": "library", | ||
"description": "Small PHP DSL for synchronizing asynchronous operations (busy-waiting)", | ||
"keywords": [ | ||
"php", | ||
"asynchronous", | ||
"busy-waiting", | ||
"testing", | ||
"quality-assurance" | ||
], | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Arkadiusz Kondas", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"require": { | ||
"php": "^7.4" | ||
}, | ||
"require-dev": { | ||
"friendsofphp/php-cs-fixer": "^2.18", | ||
"phpstan/phpstan": "^0.12.69", | ||
"phpunit/phpunit": "^9.5" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Akondas\\Exspecto\\": "src/" | ||
}, | ||
"files": [ | ||
"src/functions.php" | ||
] | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"Akondas\\Exspecto\\Tests\\": "tests/" | ||
} | ||
}, | ||
"scripts": { | ||
"build": [ | ||
"@check-cs", | ||
"@phpstan", | ||
"@phpunit" | ||
], | ||
"check-cs": [ | ||
"php-cs-fixer fix --dry-run --diff" | ||
], | ||
"fix-cs": [ | ||
"php-cs-fixer fix" | ||
], | ||
"phpstan": [ | ||
"phpstan analyse src tests --level=max" | ||
], | ||
"phpunit": [ | ||
"phpunit" | ||
] | ||
} | ||
} |
Oops, something went wrong.