$candidate = $this->prophesize(MyCandidateInterface::class);
$candidate->getValue()->willReturn($value);
$builderFactory = new BuilderFactory();
$specificationBuilder = $builderFactory->create();
$firstSpecification =
$specificationBuilder
->and(new CandidateIsHigherThanFiveCompositeSpecification())
->and(new CandidateIsLowerThanTwentyCompositeSpecification())
->or(new CandidateIsDivisableByFive())
->build();
$secondSpecification =
$specificationBuilder
->and(new CandidateIsHigherThanOneHundredCompositeSpecification())
->and(new CandidateIsLowerThanTwoHundredCompositeSpecification())
->build();
$compositeSpecification =
$specificationBuilder
->or($firstSpecification)
->or($secondSpecification)
->build();
$result = $compositeSpecification->meetsSpecification($candidate->reveal());
$this->assertEquals($expectedResult, $result, 'Value failed: ' . $value);
-
Notifications
You must be signed in to change notification settings - Fork 1
Specification pattern for filtering objects in php.
License
dirkwinkhaus/widi-filter-specification
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Specification pattern for filtering objects in php.
Resources
License
Stars
Watchers
Forks
Packages 0
No packages published