Passed
Push — master ( 8f669d...12a285 )
by Dmitrii
01:40 queued 10s
created

Recaptcha3TypeTest::testDefaultOptions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 9
nc 1
nop 0
dl 0
loc 14
rs 9.9666
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace Karser\Recaptcha3Bundle\Tests\Form;
4
5
use Karser\Recaptcha3Bundle\Form\Recaptcha3Type;
6
use Symfony\Component\Form\PreloadedExtension;
7
use Symfony\Component\Form\Test\TypeTestCase;
8
9
class Recaptcha3TypeTest extends TypeTestCase
10
{
11
    const SITEKEY = '<sitekey>';
12
13
    protected function getExtensions()
14
    {
15
        $type = new Recaptcha3Type(self::SITEKEY, $enabled = true);
16
17
        return [
18
            new PreloadedExtension([$type], []),
19
        ];
20
    }
21
22
    public function testDefaultOptions()
23
    {
24
        $data = '<captcha-token>';
25
26
        $form = $this->factory->create(Recaptcha3Type::class);
27
        $form->setData($data);
28
29
        $this->assertTrue($form->isSynchronized());
30
        $this->assertEquals($data, $form->getData());
31
32
        $view = $form->createView();
33
        $this->assertSame(self::SITEKEY, $view->vars['site_key']);
34
        $this->assertSame('homepage', $view->vars['action_name']);
35
        $this->assertTrue($view->vars['enabled']);
36
    }
37
}
38