PHP Classes

File: Library/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/empty.test

Recommend this page to a friend!
  Classes of Duong Huynh Nghia   Lego PHP   Library/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/empty.test   Download  
File: Library/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/empty.test
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Lego PHP
Blog and shopping cart system
Author: By
Last change:
Date: 7 years ago
Size: 1,043 bytes
 

Contents

Class file image Download
--TEST-- "empty" test --TEMPLATE-- {{ foo is empty ? 'ok' : 'ko' }} {{ bar is empty ? 'ok' : 'ko' }} {{ foobar is empty ? 'ok' : 'ko' }} {{ array is empty ? 'ok' : 'ko' }} {{ zero is empty ? 'ok' : 'ko' }} {{ string is empty ? 'ok' : 'ko' }} {{ countable_empty is empty ? 'ok' : 'ko' }} {{ countable_not_empty is empty ? 'ok' : 'ko' }} {{ markup_empty is empty ? 'ok' : 'ko' }} {{ markup_not_empty is empty ? 'ok' : 'ko' }} --DATA-- class CountableStub implements Countable { private $items; public function __construct(array $items) { $this->items = $items; } public function count() { return count($this->items); } } return array( 'foo' => '', 'bar' => null, 'foobar' => false, 'array' => array(), 'zero' => 0, 'string' => '0', 'countable_empty' => new CountableStub(array()), 'countable_not_empty' => new CountableStub(array(1, 2)), 'markup_empty' => new Twig_Markup('', 'UTF-8'), 'markup_not_empty' => new Twig_Markup('test', 'UTF-8'), ); --EXPECT-- ok ok ok ok ko ko ok ko ok ko