PHP code example of stratadox / specification
1. Go to this page and download the library: Download stratadox/specification library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
stratadox / specification example snippets
// The business logic
$allBoxes = CollectionOfBoxes::containing(
Box::ofWeight(1),
Box::ofWeight(2),
Box::ofWeight(3),
Box::ofWeight(5),
Box::ofWeight(12),
Box::ofWeight(26)
);
$weighBetween2and10 = AreHeavier::than(2)->and(AreLighter::than(10));
$this->assertEquals(
CollectionOfBoxes::containing(
Box::ofWeight(3),
Box::ofWeight(5),
Box::ofWeight(26)
),
$allBoxes->that($weighBetween2and10->or(AreHeavier::than(20)))
);