PhoneNumberTest::testValidate()   A
last analyzed

Complexity

Conditions 3
Paths 9

Size

Total Lines 16
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 16
rs 9.8666
c 0
b 0
f 0
cc 3
nc 9
nop 0
1
<?php
2
3
namespace Tests\Common\BasicAttribute;
4
5
use Bpost\BpostApiClient\BpostException;
6
use Bpost\BpostApiClient\Common\BasicAttribute\PhoneNumber;
7
use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidLengthException;
8
use PHPUnit_Framework_TestCase;
0 ignored issues
show
Bug introduced by
The type PHPUnit_Framework_TestCase was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
10
class PhoneNumberTest extends PHPUnit_Framework_TestCase
11
{
12
    public function testValidate()
13
    {
14
        $value = str_repeat('a', 20);
15
        try {
16
            $test = new PhoneNumber($value);
17
            $this->assertEquals($value, $test->getValue());
18
        } catch (BpostException $ex) {
19
            $this->fail('Exception launched for valid value: "' . $value . '"');
20
        }
21
22
        $value = str_repeat('a', 21);
23
        try {
24
            new PhoneNumber($value);
25
            $this->fail('Exception uncaught for invalid value: "' . $value . '"');
26
        } catch (BpostInvalidLengthException $ex) {
27
            $this->assertTrue(true);
28
        }
29
    }
30
}
31