ValueNotValidTest::testConstructor()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 13
rs 9.8333
c 0
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
/**
4
 * Created by PhpStorm.
5
 * User: benedikt
6
 * Date: 10/1/17
7
 * Time: 2:08 PM
8
 */
9
10
namespace Tfboe\FmLib\Tests\Unit\Exceptions;
11
12
13
use Tfboe\FmLib\Exceptions\ValueNotValid;
14
use Tfboe\FmLib\TestHelpers\TestEnum;
15
use Tfboe\FmLib\Tests\Helpers\UnitTestCase;
16
17
/**
18
 * Class ValueNotValidTest
19
 * @package Tfboe\FmLib\Tests\Unit\Exceptions
20
 */
21
class ValueNotValidTest extends UnitTestCase
22
{
23
//<editor-fold desc="Public Methods">
24
  /**
25
   * @covers \Tfboe\FmLib\Exceptions\ValueNotValid::__construct
26
   * @uses   \Tfboe\FmLib\Helpers\BasicEnum
27
   */
28
  public function testConstructor()
29
  {
30
    $exc = new ValueNotValid("value");
31
    self::assertEquals('The following value is not valid: "value"', $exc->getMessage());
32
33
    $exc = new ValueNotValid("val", TestEnum::class);
34
    self::assertEquals('The following value is not valid: "val" in Tfboe\FmLib\TestHelpers\TestEnum. ' .
35
      'Possible values: "value", 1.', $exc->getMessage());
36
37
    $exc = new ValueNotValid("val", TestEnum::class, "getNames");
38
    self::assertEquals('The following value is not valid: "val" in Tfboe\FmLib\TestHelpers\TestEnum. ' .
39
      'Possible values: "KEY", "INT_KEY".', $exc->getMessage());
40
  }
41
//</editor-fold desc="Public Methods">
42
}