Beispiel #1
0
 /**
  * If a Renderable object has tried to use a empty variable it returns true otherwise and when no variable
  * is used false. Needed for the Group element.
  *
  * @return boolean
  */
 public function hasAccessEmptyVariable()
 {
     foreach ($this->variables as $variable) {
         if (Container::getData()->getVariable($variable) !== null) {
             return false;
         }
     }
     if (isset($this->substitute) == true) {
         return $this->substitute->hasAccessEmptyVariable();
     }
     return true;
 }
Beispiel #2
0
 /**
  * @covers Geissler\CSL\Names\Substitute::__construct
  * @covers Geissler\CSL\Names\Substitute::render
  * @covers Geissler\CSL\Names\Substitute::hasAccessEmptyVariable
  */
 public function testRenderNothing()
 {
     $layout = '<substitute>
                     <date prefix="(" suffix=")" variable="issued">
                         <date-part name="day" suffix=" " />
                         <date-part form="long" name="month" suffix=" "/>
                         <date-part name="year" />
                     </date>
                     <number form="roman" variable="volume" />
                     <text variable="title"/>
                   </substitute>';
     $json = '[
         {
             "id": "ITEM-1",
             "type": "book"
         }
     ]';
     $this->initElement($layout, $json);
     $this->assertEquals('', $this->object->render(''));
     $this->assertTrue($this->object->hasAccessEmptyVariable());
 }