Issues (112)

BasicAttribute/EmailAddressCharacteristicTest.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace Tests\Common\BasicAttribute;
4
5
use Bpost\BpostApiClient\BpostException;
6
use Bpost\BpostApiClient\Common\BasicAttribute\EmailAddressCharacteristic;
7
use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidLengthException;
8
use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidPatternException;
9
use PHPUnit_Framework_TestCase;
0 ignored issues
show
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...
10
11
class EmailAddressCharacteristicTest extends PHPUnit_Framework_TestCase
12
{
13
    public function testValidate()
14
    {
15
        $value = '[email protected]';
16
        try {
17
            $test = new EmailAddressCharacteristic($value);
18
            $this->assertEquals($value, $test->getValue());
19
        } catch (BpostException $ex) {
20
            $this->fail('Exception launched for valid value: "' . $value . '"');
21
        }
22
23
        $value = 'myBeautifulAndLongEmailAddressFor2016@antidot-company-based-at-Brussels.com';
24
        try {
25
            new EmailAddressCharacteristic($value);
26
            $this->fail('Exception uncaught for invalid value: "' . $value . '"');
27
        } catch (BpostInvalidLengthException $ex) {
28
            $this->assertTrue(true);
29
        }
30
31
        $value = '[email protected]';
32
        try {
33
            new EmailAddressCharacteristic($value);
34
            $this->fail('Exception uncaught for invalid value: "' . $value . '"');
35
        } catch (BpostInvalidPatternException $ex) {
36
            $this->assertTrue(true);
37
        }
38
    }
39
}
40