| 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 |
include dirname(__FILE__).'/../../bootstrap/functional.php';
|
|
|
13 |
include $configuration->getSymfonyLibDir().'/vendor/lime/lime.php';
|
|
|
14 |
|
|
|
15 |
$t = new lime_test(2);
|
|
|
16 |
|
|
|
17 |
// ->__construct()
|
|
|
18 |
$t->diag('->__construct()');
|
|
|
19 |
|
|
|
20 |
class DefaultValuesForm extends AuthorForm
|
|
|
21 |
{
|
|
|
22 |
public function configure()
|
|
|
23 |
{
|
|
|
24 |
$this->setDefault('name', 'John Doe');
|
|
|
25 |
}
|
|
|
26 |
}
|
|
|
27 |
|
|
|
28 |
$author = new Author();
|
|
|
29 |
$form = new DefaultValuesForm($author);
|
|
|
30 |
$t->is($form->getDefault('name'), 'John Doe', '->__construct() uses form defaults for new objects');
|
|
|
31 |
|
|
|
32 |
$author = new Author();
|
|
|
33 |
$author->setName('Jacques Doe');
|
|
|
34 |
$author->save();
|
|
|
35 |
$form = new DefaultValuesForm($author);
|
|
|
36 |
$t->is($form->getDefault('name'), 'Jacques Doe', '->__construct() uses object value as a default for existing objects');
|
|
|
37 |
$author->delete();
|