]> git.immae.eu Git - github/wallabag/wallabag.git/blame - vendor/twig/twig/test/Twig/Tests/Fixtures/tests/empty.test
gitignore vendor
[github/wallabag/wallabag.git] / vendor / twig / twig / test / Twig / Tests / Fixtures / tests / empty.test
CommitLineData
4f5b44bd
NL
1--TEST--
2"empty" test
3--TEMPLATE--
4{{ foo is empty ? 'ok' : 'ko' }}
5{{ bar is empty ? 'ok' : 'ko' }}
6{{ foobar is empty ? 'ok' : 'ko' }}
7{{ array is empty ? 'ok' : 'ko' }}
8{{ zero is empty ? 'ok' : 'ko' }}
9{{ string is empty ? 'ok' : 'ko' }}
10{{ countable_empty is empty ? 'ok' : 'ko' }}
11{{ countable_not_empty is empty ? 'ok' : 'ko' }}
12{{ markup_empty is empty ? 'ok' : 'ko' }}
13{{ markup_not_empty is empty ? 'ok' : 'ko' }}
14--DATA--
15
16class CountableStub implements Countable
17{
18 private $items;
19
20 public function __construct(array $items)
21 {
22 $this->items = $items;
23 }
24
25 public function count()
26 {
27 return count($this->items);
28 }
29}
30return array(
31 'foo' => '', 'bar' => null, 'foobar' => false, 'array' => array(), 'zero' => 0, 'string' => '0',
32 'countable_empty' => new CountableStub(array()), 'countable_not_empty' => new CountableStub(array(1, 2)),
33 'markup_empty' => new Twig_Markup('', 'UTF-8'), 'markup_not_empty' => new Twig_Markup('test', 'UTF-8'),
34);
35--EXPECT--
36ok
37ok
38ok
39ok
40ko
41ko
42ok
43ko
44ok
45ko