Completed
Push — master ( 316ab6...ce7de3 )
by Владислав
02:26
created

AnticaptchaTest::testEnum()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 13
Code Lines 9

Duplication

Lines 13
Ratio 100 %

Importance

Changes 0
Metric Value
dl 13
loc 13
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 9
nc 2
nop 0
1
<?php
2
3
/**
4
 * Class AnticaptchaTest.
5
 */
6
class AnticaptchaTest extends PHPUnit_Framework_TestCase
1 ignored issue
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
7
{
8 View Code Duplication
    public function testRecognize()
1 ignored issue
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...
9
    {
10
        $captcha = new \jumper423\decaptcha\services\Anticaptcha([
11
            \jumper423\decaptcha\services\Anticaptcha::PARAM_SPEC_API_KEY => '5464654645646',
12
        ]);
13
        $captcha->setErrorLang(\jumper423\decaptcha\core\DeCaptchaErrors::LANG_RU);
14
        if ($captcha->recognize(__DIR__.'/data/Captcha.jpg')) {
15
            $this->assertEquals('11111111111111', $captcha->getCode());
16
        } else {
17
            $this->assertEquals('Использован несуществующий key', $captcha->getError());
18
        }
19
    }
20
21 View Code Duplication
    public function testEnum()
1 ignored issue
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...
22
    {
23
        $captcha = new \jumper423\decaptcha\services\Anticaptcha([
24
            \jumper423\decaptcha\services\Anticaptcha::PARAM_SPEC_API_KEY => '5464654645646',
25
            \jumper423\decaptcha\services\Anticaptcha::ACTION_FIELD_LANGUAGE => 'ru',
26
        ]);
27
        $captcha->setErrorLang(\jumper423\decaptcha\core\DeCaptchaErrors::LANG_RU);
28
        if ($captcha->recognize(__DIR__ . '/data/Captcha.jpg')) {
29
            $this->assertEquals('11111111111111', $captcha->getCode());
30
        } else {
31
            $this->assertEquals('Нет в допустимых значиниях поля: languagePool = ru', $captcha->getError());
32
        }
33
    }
34
}
35