public function __construct($date, $options, $defaultOptions)
 {
     $local_options = array_merge(self::$defaultOptions, $defaultOptions, $options);
     parent::__construct($local_options);
     $this->now = new SimpleDateTime('now', $date->getTimezone());
     $this->date = new SimpleDateTime($date);
     $this->date->setTime(0, 0, 0);
 }
         return '<body><div></div></body>' == $builder;
     };
     $unitTests['Close Until (exclude tag)'] = function () {
         $builder = new SimpleHTMLBuilder(array('openTags' => function () {
         }));
         $builder->body()->div()->closeUntil('body', array('excludeTag' => true));
         return '<body><div></div>' == $builder;
     };
     $unitTests['Close Until (max count: 2)'] = function () {
         $builder = new SimpleHTMLBuilder(array('openTags' => function () {
         }));
         $builder->body()->div()->div()->closeUntil('body', array('maxCount' => 2));
         return '<body><div><div></div></div>' == $builder;
     };
     $unitTests['Close Until (non-existent tag)'] = function () {
         $builder = new SimpleHTMLBuilder();
         $builder->body()->div()->closeUntil('html');
         return '<body><div></div></body>' == $builder;
     };
     $passedCount = 0;
     foreach ($unitTests as $name => $test) {
         $testResult = call_user_func($test);
         echo $name . ' Test ... ' . ($testResult ? 'passed' : 'failed') . PHP_EOL;
         if ($testResult) {
             $passedCount++;
         }
     }
     echo '---' . PHP_EOL;
     echo 'Passed ' . $passedCount . ' of ' . count($unitTests) . ' tests.' . PHP_EOL;
     exit(count($unitTests) - $passedCount);
 }