4 * This file is part of the Symfony CMF package.
6 * (c) 2011-2015 Symfony CMF
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Cmf\Component\Routing\Tests\Candidates;
14 use Symfony\Cmf\Component\Routing\Candidates\Candidates;
15 use Symfony\Component\HttpFoundation\Request;
17 class CandidatesTest extends \PHPUnit_Framework_Testcase
20 * Everything is a candidate.
22 public function testIsCandidate()
24 $candidates = new Candidates();
25 $this->assertTrue($candidates->isCandidate('/routes'));
26 $this->assertTrue($candidates->isCandidate('/routes/my/path'));
30 * Nothing should be called on the query builder.
32 public function testRestrictQuery()
34 $candidates = new Candidates();
35 $candidates->restrictQuery(null);
38 public function testGetCandidates()
40 $request = Request::create('/my/path.html');
42 $candidates = new Candidates();
43 $paths = $candidates->getCandidates($request);
56 public function testGetCandidatesLocales()
58 $candidates = new Candidates(array('de', 'fr'));
60 $request = Request::create('/fr/path.html');
61 $paths = $candidates->getCandidates($request);
75 $request = Request::create('/it/path.html');
76 $paths = $candidates->getCandidates($request);
89 public function testGetCandidatesLimit()
91 $candidates = new Candidates(array(), 1);
93 $request = Request::create('/my/path/is/deep.html');
95 $paths = $candidates->getCandidates($request);
99 '/my/path/is/deep.html',