ReferenceExceptionTest::testJsonMessage()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 6
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 6
loc 6
rs 10
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\ReferenceException;
14
use Tfboe\FmLib\Tests\Helpers\UnitTestCase;
15
16
/**
17
 * Class ValueNotValidTest
18
 * @package Tfboe\FmLib\Tests\Unit\Exceptions
19
 */
20 View Code Duplication
class ReferenceExceptionTest extends UnitTestCase
0 ignored issues
show
Duplication introduced by
This class 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...
21
{
22
//<editor-fold desc="Public Methods">
23
  /**
24
   * @covers \Tfboe\FmLib\Exceptions\ReferenceException::__construct
25
   */
26
  public function testConstructor()
27
  {
28
    $exc = new ReferenceException('value', 'name');
29
    self::assertEquals("The reference value of name is not existing!", $exc->getMessage());
30
    self::assertEquals(409, $exc->getCode());
31
  }
32
33
  /**
34
   * @covers \Tfboe\FmLib\Exceptions\ReferenceException::getJsonMessage
35
   * @uses   \Tfboe\FmLib\Exceptions\ReferenceException::__construct
36
   */
37
  public function testJsonMessage()
38
  {
39
    $exc = new ReferenceException('value', 'name');
40
    self::assertEquals(['message' => 'Reference Exception', 'referenceValue' => 'value', 'referenceName' => 'name'],
41
      $exc->getJsonMessage());
42
  }
43
//</editor-fold desc="Public Methods">
44
}