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

Recaptcha3TypeTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 14
dl 0
loc 27
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getExtensions() 0 6 1
A testDefaultOptions() 0 14 1
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