Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
 
3
/*
4
 * This file is part of the symfony package.
5
 * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
 
11
$app = 'backend';
12
$fixtures = 'fixtures';
13
require_once(dirname(__FILE__).'/../bootstrap/functional.php');
14
 
15
$tests = array(
16
  '/doctrine/route/test1' => '/Article/',
17
  '/doctrine/route/test2' => '/Article/',
18
  '/doctrine/route/test3' => '/Doctrine_Collection/',
19
  '/doctrine/route/test4' => '/Doctrine_Collection/',
20
  '/doctrine/route/test5/1/some_fake_value' => '/Article/',
21
  '/doctrine/route/test6/english-title/some_fake_value' => '/Article/',
22
  '/doctrine/route/test7/some_fake_value' => '/Doctrine_Collection/',
23
  '/doctrine/route/test9/1/english-title/English+Title/test' => '/Article/',
24
  '/doctrine/route/test10/1/test' => '/Doctrine_Collection/',
25
);
26
 
27
$b = new sfTestBrowser();
28
foreach ($tests as $url => $check)
29
{
30
  $b->
31
    get($url)->
32
    with('response')->begin()->
33
      isStatusCode('200')->
34
      matches($check)->
35
    end()
36
  ;
37
}
38
 
39
$article = Doctrine_Core::getTable('Article')->find(1);
40
 
41
$routes = array(
42
  'doctrine_route_test5' => array(
43
    'url' => '/index.php/doctrine/route/test5/1/test-english-title',
44
    'params' => $article
45
  ),
46
  'doctrine_route_test6' => array(
47
    'url' => '/index.php/doctrine/route/test6/english-title/test-english-title',
48
    'params' => $article
49
  ),
50
  'doctrine_route_test7' => array(
51
    'url' => '/index.php/doctrine/route/test7/w00t',
52
    'params' => array('testing_non_column' => 'w00t')
53
  ),
54
  'doctrine_route_test8' => array(
55
    'url' => '/index.php/doctrine/route/test8/1/english-title/English+Title/test',
56
    'params' => array(
57
      'id' => $article->id,
58
      'slug' => $article->slug,
59
      'title' => $article->title,
60
      'testing_non_column2' => 'test'
61
    )
62
  ),
63
);
64
 
65
foreach ($routes as $route => $check)
66
{
67
  $url = url_for2($route, $check['params']);
68
  $b->test()->is($url, $check['url'], 'Check "' . $route . '" generates correct url');
69
}