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) 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 = 'frontend';
12
$fixtures = 'fixtures/fixtures.yml';
13
if (!include(dirname(__FILE__).'/../bootstrap/functional.php'))
14
{
15
  return;
16
}
17
 
18
$b = new sfTestBrowser(new sfBrowser());
19
$b->setTester('propel', 'sfTesterPropel');
20
 
21
// en
22
$b->
23
  get('/i18n/default')->
24
  with('request')->begin()->
25
    isParameter('module', 'i18n')->
26
    isParameter('action', 'default')->
27
  end()->
28
  with('response')->begin()->
29
    isStatusCode(200)->
30
    checkElement('#movies .toString:first', '')->
31
    checkElement('#movies .default:first', '')->
32
    checkElement('#movies .it:first', 'La Vita è bella')->
33
    checkElement('#movies .fr:first', 'La Vie est belle')->
34
  end()
35
;
36
 
37
// fr
38
$b->
39
  get('/i18n/index')->
40
  with('request')->begin()->
41
    isParameter('module', 'i18n')->
42
    isParameter('action', 'index')->
43
  end()->
44
  with('response')->begin()->
45
    isStatusCode(200)->
46
    checkElement('#movies .toString:first', 'La Vie est belle')->
47
    checkElement('#movies .default:first', 'La Vie est belle')->
48
    checkElement('#movies .it:first', 'La Vita è bella')->
49
    checkElement('#movies .fr:first', 'La Vie est belle')->
50
  end()
51
;
52
 
53
// still fr
54
$b->
55
  get('/i18n/default')->
56
  with('request')->begin()->
57
    isParameter('module', 'i18n')->
58
    isParameter('action', 'default')->
59
  end()->
60
  with('response')->begin()->
61
    isStatusCode(200)->
62
    checkElement('#movies .toString:first', 'La Vie est belle')->
63
    checkElement('#movies .default:first', 'La Vie est belle')->
64
    checkElement('#movies .it:first', 'La Vita è bella')->
65
    checkElement('#movies .fr:first', 'La Vie est belle')->
66
  end()
67
;
68
 
69
// i18n forms
70
$b->
71
  get('/i18n/movie')->
72
  with('request')->begin()->
73
    isParameter('module', 'i18n')->
74
    isParameter('action', 'movie')->
75
  end()->
76
  with('response')->begin()->
77
    isStatusCode(200)->
78
    checkElement('#movie_fr_id', false)->
79
    checkElement('#movie_fr_culture', false)->
80
  end()->
81
 
82
  click('submit', array('movie' => array('director' => 'Robert Aldrich', 'en' => array('title' => 'The Dirty Dozen'), 'fr' => array('title' => 'Les Douze Salopards'))))->
83
  with('response')->begin()->
84
    isRedirected()->
85
    followRedirect()->
86
  end()->
87
  with('response')->begin()->
88
    checkElement('input[value="Robert Aldrich"]')->
89
    checkElement('input[value="The Dirty Dozen"]')->
90
    checkElement('input[value="Les Douze Salopards"]')->
91
    checkElement('#movie_fr_id', true)->
92
    checkElement('#movie_fr_culture', true)->
93
  end()->
94
 
95
  with('propel')->begin()->
96
    check('Movie', array(), 2)->
97
    check('Movie', array('director' => 'Robert Aldrich', 'id' => 2))->
98
    check('MovieI18N', array(), 4)->
99
    check('MovieI18N', array('id' => 2), 2)->
100
    check('MovieI18N', array('culture' => 'fr', 'id' => 2, 'title' => 'Les Douze Salopards'))->
101
    check('MovieI18N', array('culture' => 'en', 'id' => 2, 'title' => 'The Dirty Dozen'))->
102
  end()->
103
 
104
  click('submit', array('movie' => array('director' => 'Robert Aldrich (1)', 'en' => array('title' => 'The Dirty Dozen (1)'), 'fr' => array('title' => 'Les Douze Salopards (1)'))))->
105
  with('response')->begin()->
106
    isRedirected()->
107
    followRedirect()->
108
  end()->
109
  with('response')->begin()->
110
    checkElement('input[value="Robert Aldrich (1)"]')->
111
    checkElement('input[value="The Dirty Dozen (1)"]')->
112
    checkElement('input[value="Les Douze Salopards (1)"]')->
113
  end()->
114
 
115
  with('propel')->begin()->
116
    check('Movie', array(), 2)->
117
    check('Movie', array('director' => 'Robert Aldrich (1)', 'id' => 2))->
118
    check('MovieI18N', array(), 4)->
119
    check('MovieI18N', array('id' => 2), 2)->
120
    check('MovieI18N', array('culture' => 'fr', 'id' => 2, 'title' => 'Les Douze Salopards (1)'))->
121
    check('MovieI18N', array('culture' => 'en', 'id' => 2, 'title' => 'The Dirty Dozen (1)'))->
122
  end()->
123
 
124
  // Bug #7486
125
  click('submit')->
126
 
127
  with('form')->begin()->
128
    hasErrors(false)->
129
  end()->
130
 
131
  get('/i18n/movie')->
132
  click('submit', array('movie' => array('director' => 'Robert Aldrich', 'en' => array('title' => 'The Dirty Dozen (1)'), 'fr' => array('title' => 'Les Douze Salopards (1)'))))->
133
 
134
  with('form')->begin()->
135
    hasErrors(2)->
136
  end()->
137
 
138
  click('submit', array('movie' => array('director' => 'Robert Aldrich', 'en' => array('title' => 'The Dirty Dozen'), 'fr' => array('title' => 'Les Douze Salopards'))))->
139
 
140
  with('form')->begin()->
141
    hasErrors(false)->
142
  end()->
143
  with('response')->begin()->
144
    isRedirected()->
145
    followRedirect()->
146
  end()->
147
  with('response')->begin()->
148
    checkElement('input[value="Robert Aldrich"]')->
149
    checkElement('input[value="The Dirty Dozen"]')->
150
    checkElement('input[value="Les Douze Salopards"]')->
151
  end()
152
  // END: Bug #7486
153
;
154
 
155
$b->getAndCheck('i18n', 'products')
156
  ->with('response')->begin()
157
    ->checkElement('ul#products li.toString', 'PRIMARY STRING')
158
  ->end()
159
;