Yaffs site version 1.1
[yaffs-website] / vendor / twig / twig / test / Twig / Tests / Fixtures / tests / null_coalesce.test
diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/null_coalesce.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/null_coalesce.test
new file mode 100644 (file)
index 0000000..3d148c8
--- /dev/null
@@ -0,0 +1,30 @@
+--TEST--
+Twig supports the ?? operator
+--TEMPLATE--
+{{ 'OK' ?? 'KO' }}
+{{ null ?? 'OK' }}
+{{ bar ?? 'KO' }}
+{{ baz ?? 'OK' }}
+{{ foo.bar ?? 'KO' }}
+{{ foo.missing ?? 'OK' }}
+{{ foo.bar.baz.missing ?? 'OK' }}
+{{ foo['bar'] ?? 'KO' }}
+{{ foo['missing'] ?? 'OK' }}
+{{ nope ?? nada ?? 'OK' }}
+{{ 1 + nope ?? nada ?? 2 }}
+{{ 1 + nope ?? 3 + nada ?? 2 }}
+--DATA--
+return array('bar' => 'OK', 'foo' => array('bar' => 'OK'))
+--EXPECT--
+OK
+OK
+OK
+OK
+OK
+OK
+OK
+OK
+OK
+OK
+3
+6