/** * create a check that is ready to execute * * @param array $checks * a list of the checks to apply * @param FactoryList|null $exceptions * the functions to call when we want to throw an exception */ public function __construct($checks, FactoryList $exceptions = null) { // make sure we have exceptions to use if ($exceptions === null) { $exceptions = new DefensiveExceptions(); } // robustness RequireValidChecks::apply($exceptions)->toList($checks); // we're good (for now) $this->checks = $checks; }
/** * @covers ::apply * @covers ::toList * @covers ::to * @dataProvider provideNonListsToTest * @expectedException InvalidArgumentException */ public function test_throws_InvalidArgumentException_if_non_list_passed_to_toList($list) { // ---------------------------------------------------------------- // setup your test // ---------------------------------------------------------------- // perform the change RequireValidChecks::apply()->toList($list); }