/
TypeExtensionTest.php
96 lines (89 loc) · 3.3 KB
/
TypeExtensionTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<?php
/*
* This file is part of the Symfony package.
*
* (c) Olivier Chauvel <olivier@generation-multiple.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Genemu\Bundle\FormBundle\Tests\Form\Extension;
use Symfony\Component\Form\Extension\Core\CoreExtension;
use Symfony\Component\HttpFoundation\Session;
use Symfony\Component\HttpFoundation\SessionStorage\ArraySessionStorage;
use Symfony\Component\HttpFoundation\Request;
use Genemu\Bundle\FormBundle\Gd\Type\Captcha;
use Genemu\Bundle\FormBundle\Form\Core\Validator\ReCaptchaValidator;
use Genemu\Bundle\FormBundle\Form;
/**
* @author Olivier Chauvel <olivier@generation-multiple.com>
*/
class TypeExtensionTest extends CoreExtension
{
protected $request;
public function __construct(Request $request)
{
$this->request = $request;
}
protected function loadTypes()
{
return array_merge(parent::loadTypes(), array(
new Form\Core\Type\TinymceType(array()),
new Form\JQuery\Type\DateType(array()),
new Form\JQuery\Type\SliderType(),
new Form\Core\Type\CaptchaType(new Captcha(new Session(new ArraySessionStorage()), 's$cr$t'), array(
'script' => 'genemu_upload',
'uploader' => '/js/uploadify.swf',
'cancelImg' => '/images/cancel.png',
'folder' => '/upload',
'width' => 100,
'height' => 30,
'length' => 4,
'position' => 'left',
'format' => 'png',
'chars' => range(0, 9),
'font_size' => 18,
'font_color' => array(
'252525',
'8B8787',
'550707',
'3526E6',
'88531E'
),
'fonts' => array(
__DIR__ . '/../../Fixtures/fonts/akbar.ttf',
__DIR__ . '/../../Fixtures/fonts/brushcut.ttf',
__DIR__ . '/../../Fixtures/fonts/molten.ttf',
__DIR__ . '/../../Fixtures/fonts/planetbe.ttf',
__DIR__ . '/../../Fixtures/fonts/whoobub.ttf',
),
'background_color' => 'DDDDDD',
'border_color' => '000000'
)),
new Form\JQuery\Type\FileType(array(
'script' => 'genemu_upload',
'uploader' => '/swf/uploadify.swf',
'cancel_img' => '/images/cancel.png',
'folder' => '/upload'
), __DIR__.'/../../Fixtures'),
new Form\Core\Type\ReCaptchaType(
new ReCaptchaValidator($this->request, 'privateKey'),
'publicKey',
'http://api.recaptcha.net',
array()),
new Form\JQuery\Type\AutocompleterType(),
new Form\JQuery\Type\ImageType('medium', array(
'small' => array(100, 100),
'medium' => array(200, 200),
'large' => array(500, 500),
'extra' => array(1024, 768)
), array(
'rotate',
'bw',
'negative',
'sepia',
'crop'
)),
));
}
}