#### Echo program
Example Free Monad example of `echo program` can be found here:
-- [FreeMonadTest.php](/example/FreeMonadTest.php) - example based on first implementation of Free
-- [Free2MonadTest.php](/example/Free2MonadTest.php) - example based on second implementation of Free, based on [Haskell implementation](https://hackage.haskell.org/package/free-4.12.4/docs/Control-Monad-Free-Class.html)
+- See source code [FreeMonadTest.php](/example/FreeMonadTest.php) - example based on first implementation of Free
+- See source code [Free2MonadTest.php](/example/Free2MonadTest.php) - example based on second implementation of Free, based on [Haskell implementation](https://hackage.haskell.org/package/free-4.12.4/docs/Control-Monad-Free-Class.html)
#### DSL for `BDD` tests
Example that use `Free Monad` to creates simple DSL (Domain Specific Language) to define BDD type of framework:
-- [Free2BddStyleDSLTest.php](/example/Free2BddStyleDSLTest.php) - example based on second implementation of Free, based on [Haskell implementation](https://hackage.haskell.org/package/free-4.12.4/docs/Control-Monad-Free-Class.html)
-
+- See source code [Free2BddStyleDSLTest.php](/example/Free2BddStyleDSLTest.php)
```php
$state = [
'productsCount' => 0,
}), func_get_args());
}
+/**
+ * Inspired by https://github.com/politrons/TestDSL
+ */
class Free2BddStyleDSLTest extends \PHPUnit_Framework_TestCase
{
public function test_it_should_interpret_bdd_scenario()
private function randomize()
{
- return Listt::of(array_keys(array_fill(0, rand(20, 100), null)));
+ return Listt::of(array_keys(array_fill(0, random_int(20, 100), null)));
}
public function provideRandomizedData()
private function randomize()
{
- return Num::of(rand(-100000000, 100000000));
+ return Num::of(random_int(-100000000, 100000000));
}
public function provideSetoidLaws()
private function randomize()
{
- return Product::of(rand(-100000000, 100000000));
+ return Product::of(random_int(-100000000, 100000000));
}
public function provideSetoidLaws()
private function randomize()
{
- return Stringg::of(md5(rand(0, 100)));
+ return Stringg::of(md5(random_int(0, 100)));
}
public function provideRandomizedData()
private function randomize()
{
- return Sum::of(rand(-100000000, 100000000));
+ return Sum::of(random_int(-100000000, 100000000));
}
public function provideSetoidLaws()