/
Recaptcha3TypeTest.php
37 lines (28 loc) · 1017 Bytes
/
Recaptcha3TypeTest.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
<?php declare(strict_types=1);
namespace Karser\Recaptcha3Bundle\Tests\Form;
use Karser\Recaptcha3Bundle\Form\Recaptcha3Type;
use Symfony\Component\Form\PreloadedExtension;
use Symfony\Component\Form\Test\TypeTestCase;
class Recaptcha3TypeTest extends TypeTestCase
{
const SITEKEY = '<sitekey>';
protected function getExtensions()
{
$type = new Recaptcha3Type(self::SITEKEY, $enabled = true);
return [
new PreloadedExtension([$type], []),
];
}
public function testDefaultOptions()
{
$data = '<captcha-token>';
$form = $this->factory->create(Recaptcha3Type::class);
$form->setData($data);
$this->assertTrue($form->isSynchronized());
$this->assertEquals($data, $form->getData());
$view = $form->createView();
$this->assertSame(self::SITEKEY, $view->vars['site_key']);
$this->assertSame('homepage', $view->vars['action_name']);
$this->assertTrue($view->vars['enabled']);
}
}