AnticaptchaTest::testEnum()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 13

Duplication

Lines 13
Ratio 100 %

Importance

Changes 0
Metric Value
dl 13
loc 13
rs 9.8333
c 0
b 0
f 0
cc 2
nc 2
nop 0
1
<?php
2
3
use jumper423\decaptcha\services\Anticaptcha;
4
5
/**
6
 * Class AnticaptchaTest.
7
 */
8
class AnticaptchaTest extends PHPUnit_Framework_TestCase
9
{
10 View Code Duplication
    public function testRecognize()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
11
    {
12
        $captcha = new Anticaptcha([
13
            \jumper423\decaptcha\services\Anticaptcha::ACTION_FIELD_KEY => '5464654645646',
14
        ]);
15
        $captcha->setErrorLang(\jumper423\decaptcha\core\DeCaptchaErrors::LANG_RU);
16
        if ($captcha->recognize(__DIR__.'/data/Captcha.jpg')) {
17
            $this->assertEquals('11111111111111', $captcha->getCode());
18
        } else {
19
            $this->assertEquals('Использован несуществующий key', $captcha->getError());
20
        }
21
    }
22
23 View Code Duplication
    public function testEnum()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
24
    {
25
        $captcha = new \jumper423\decaptcha\services\Anticaptcha([
26
            \jumper423\decaptcha\services\Anticaptcha::ACTION_FIELD_KEY      => '5464654645646',
27
            \jumper423\decaptcha\services\Anticaptcha::ACTION_FIELD_LANGUAGE => 'ru',
28
        ]);
29
        $captcha->setErrorLang(\jumper423\decaptcha\core\DeCaptchaErrors::LANG_RU);
30
        if ($captcha->recognize(__DIR__.'/data/Captcha.jpg')) {
31
            $this->assertEquals('11111111111111', $captcha->getCode());
32
        } else {
33
            $this->assertEquals('Нет в допустимых значениях поля: languagePool = ru', $captcha->getError());
34
        }
35
    }
36
}
37