/** * @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()); }
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()); }
/** * @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); }
/** * @see Base */ protected function isEmpty($value) { if (is_array($value)) { $filtered = array_filter($value); return empty($filtered); } return parent::isEmpty($value); }