testResolveOptionsSuccessfully(); $this->testMissingRequiredOptions(); $this->testInvalidOptions(); } public function testResolveOptionsSuccessfully() { $resolver = new OptionsResolver([ Option::mixed('option1'), Option::mixed('option2')->setOptional('default'), ]); $options = $resolver->resolve([ 'option1' => 'value1', ]); $this->assertStrictEquals($options, ['option1' => 'value1', 'option2' => 'default']); } public function testMissingRequiredOptions() { $resolver = new OptionsResolver([ Option::mixed('requiredOption'), ]); $this->expectException(\InvalidArgumentException::class, function () use ($resolver) { $resolver->resolve([]); }); } public function testInvalidOptions() { $resolver = new OptionsResolver([ Option::mixed('validOption')->validator(static function ($value) { return $value > 0; }), ]); $this->expectException(\InvalidArgumentException::class, function () use ($resolver) { $resolver->resolve(['validOption' => 0]); }); } }