Completed
Push — master ( 75ca6a...d59674 )
by Владислав
02:12
created

TwoCaptchaTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 30
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testRecognizeBalanceError1() 0 9 1
A testRecognizeBalanceError2() 0 12 2
1
<?php
2
3
/**
4
 * Class TwoCaptchaTest.
5
 */
6
class TwoCaptchaTest 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
    /**
9
     * @expectedException \jumper423\decaptcha\core\DeCaptchaErrors
10
     * @expectedExceptionMessage Нулевой либо отрицательный баланс
11
     * @expectedExceptionCode 3
12
     */
13
    public function testRecognizeBalanceError1()
14
    {
15
        $captcha = new \jumper423\decaptcha\services\TwoCaptcha([
16
            \jumper423\decaptcha\services\TwoCaptcha::PARAM_SPEC_API_KEY => '200a1ed2b6ca001d8171c655658086ed',
17
        ]);
18
        $captcha->setErrorLang(\jumper423\decaptcha\core\DeCaptchaErrors::LANG_RU);
19
        $captcha->setCauseAnError(true);
20
        $captcha->recognize(__DIR__ . '/data/Captcha.jpg');
21
    }
22
23
    public function testRecognizeBalanceError2()
24
    {
25
        $captcha = new \jumper423\decaptcha\services\TwoCaptcha([
26
            \jumper423\decaptcha\services\TwoCaptcha::PARAM_SPEC_API_KEY => '200a1ed2b6ca001d8171c655658086ed',
27
        ]);
28
        $captcha->setErrorLang(\jumper423\decaptcha\core\DeCaptchaErrors::LANG_RU);
29
        if ($captcha->recognize(__DIR__ . '/data/Captcha.jpg')) {
30
            $this->assertEquals('11111111111111', $captcha->getCode());
31
        } else {
32
            $this->assertEquals('Нулевой либо отрицательный баланс', $captcha->getError());
33
        }
34
    }
35
}
36