Example #1
0
 /**
  * Bootstrap the options.
  *
  * @param array  $options The option values
  * @param Runner $runner  The test runner
  *
  * @return self The options object
  */
 public function __construct(array $options = [], Runner $runner = null)
 {
     if ($runner !== null) {
         $this->runner = $runner;
         $options = $this->parseOptions();
     }
     parent::__construct($options);
 }
Example #2
0
 /**
  * Tests that nested paths can be set directly.
  *
  * @covers Molovo\Object\Object::setValueForPath
  *
  * @uses Molovo\Object\Object::valueForPath
  */
 public function testSetValueForNonexistentPath()
 {
     $array = ['testing' => ['nested' => ['data' => true]]];
     $object = new Object($array);
     $object->setValueForPath('testing.nested.doesnotexist', 'changed');
     verify($object->valueForPath('testing.nested.doesnotexist'))->equals('changed');
     $object->setValueForPath('nonexistent.nested.path', 'changed');
     verify($object->nonexistent)->isInstanceOf(Object::class);
     verify($object->nonexistent->nested)->isInstanceOf(Object::class);
     verify($object->nonexistent->nested->path)->equals('changed');
     verify($object->valueForPath('nonexistent.nested.path'))->equals('changed');
 }