/** * create an Assurance that is ready to execute * * @param array $assurances * a list of the assurances to apply * @param FactoryList|null $exceptions * the functions to call when we want to throw an exception */ public function __construct($assurances, FactoryList $exceptions = null) { // make sure we have exceptions to use if ($exceptions === null) { $exceptions = new DefensiveExceptions(); } $this->exceptions = $exceptions; // robustness RequireValidAssurances::apply()->toList($assurances); // we're good (for now) $this->assurances = $assurances; }
/** * @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 RequireValidAssurances::apply()->toList($list); }