Author: Raphael Antonmattei (rantonmattei@theorchard.com)
コード例 #1
0
 /**
  * Test resolving with invalid options. It should throw an exception.
  *
  * @param  array $invalidOptions Array of invalid options
  * @dataProvider invalidOptionsProvider
  * @expectedException Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException
  */
 public function testResolveWithInvalidOptions($invalidOptions)
 {
     $this->resolver->resolve($invalidOptions);
 }
コード例 #2
0
 /**
  * Resolve options and returns them into 2 buckets:
  *   - constructor options and
  *   - extra options
  * Extra options are those that are not in the contructor. The constructor arguments determine
  * what goes into which bucket
  *
  * @return array array of constructorOptions and extraOptions
  */
 private function resolveOptions()
 {
     $constructorResolver = new ConstructorResolver($this->reflected);
     // Contructor options are only the ones matching the contructor args' names
     $constructorOptions = array_intersect_key($this->rawOptions, $constructorResolver->getConstructorArgs());
     // Extra options are everything else than contructor options
     $extraOptions = array_diff_key($this->rawOptions, $constructorOptions);
     $extraOptionsResolver = new ExtraOptionsResolver($this->reflected, array_keys($extraOptions));
     return array($constructorResolver->resolve($constructorOptions), $extraOptionsResolver->resolve($extraOptions, $this));
 }