Exemplo n.º 1
0
 /**
  * @return null
  */
 public function testConstructor()
 {
     $this->assertInstanceOf('\\Appfuel\\View\\Html\\Tag\\GenericTagInterface', $this->meta);
     /*
      * no content should be added to this tag  
      */
     $this->assertTrue($this->meta->isEmpty());
 }
Exemplo n.º 2
0
 public function testIsEmpty()
 {
     $instance1 = new Base('');
     $this->assertTrue($instance1->isEmpty());
     $instance2 = new Base('   ');
     $this->assertTrue($instance2->isEmpty());
     $instance3 = new Base(false);
     $this->assertTrue($instance3->isEmpty());
     $instance4 = new Base(null);
     $this->assertTrue($instance4->isEmpty());
     $instance5 = new Base('0');
     $this->assertFalse($instance5->isEmpty());
     $instance6 = new Base('foo');
     $this->assertFalse($instance6->isEmpty());
 }
Exemplo n.º 3
0
 /**
  * @see Base
  */
 protected function isEmpty($value)
 {
     if (is_array($value)) {
         // array is not empty when a value is found
         foreach ($value as $key => $val) {
             // int and string '0' are 'empty' values that are explicitly accepted
             if ($val === 0 || $val === '0' || !empty($val)) {
                 return false;
             }
         }
         return true;
     }
     return parent::isEmpty($value);
 }
Exemplo n.º 4
0
 /**
  * @see Base
  */
 protected function isEmpty($value)
 {
     if (is_array($value)) {
         $filtered = array_filter($value);
         return empty($filtered);
     }
     return parent::isEmpty($value);
 }