* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ namespace Chill\MainBundle\Tests\Services; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; use Symfony\Component\DomCrawler\Crawler; /** * Test the Twig function 'chill_menu' * * @author Julien Fastré */ class ChillMenuTwigFunctionTest extends KernelTestCase { private static $templating; public static function setUpBeforeClass() { self::bootKernel(array('environment' => 'test')); static::$templating = static::$container ->get('templating'); $pathToBundle = static::$container->getParameter('kernel.bundles_metadata')['ChillMainBundle']['path']; //load templates in Tests/Resources/views static::$container->get('twig.loader') ->addPath($pathToBundle.'/Resources/test/views/', $namespace = 'tests'); } public function testNormalMenu() { $content = static::$templating->render('@tests/menus/normalMenu.html.twig'); $this->assertContains('ul', $content, "test that the file contains an ul tag" ); } }