Code Duplication    Length = 25-26 lines in 5 locations

tests/Unit/Exceptions/DuplicateExceptionTest.php 1 location

@@ 20-44 (lines=25) @@
17
 * Class ValueNotValidTest
18
 * @package Tfboe\FmLib\Tests\Unit\Exceptions
19
 */
20
class DuplicateExceptionTest extends UnitTestCase
21
{
22
//<editor-fold desc="Public Methods">
23
  /**
24
   * @covers \Tfboe\FmLib\Exceptions\DuplicateException::__construct
25
   */
26
  public function testConstructor()
27
  {
28
    $exc = new DuplicateException('value', 'name', 'array');
29
    self::assertEquals($exc->getMessage(), "The name value occurs twice in array");
30
    self::assertEquals(409, $exc->getCode());
31
  }
32
33
  /**
34
   * @covers \Tfboe\FmLib\Exceptions\DuplicateException::getJsonMessage
35
   * @uses   \Tfboe\FmLib\Exceptions\DuplicateException::__construct
36
   */
37
  public function testJsonMessage()
38
  {
39
    $exc = new DuplicateException('value', 'name', 'array');
40
    self::assertEquals(['message' => 'Duplicate Exception', 'duplicateValue' => 'value', 'arrayName' => 'array'],
41
      $exc->getJsonMessage());
42
  }
43
//</editor-fold desc="Public Methods">
44
}

tests/Unit/Exceptions/MethodNotExistingExceptionTest.php 1 location

@@ 20-44 (lines=25) @@
17
 * Class AuthenticationExceptionTest
18
 * @package Tfboe\FmLib\Tests\Unit\Exceptions
19
 */
20
class MethodNotExistingExceptionTest extends UnitTestCase
21
{
22
//<editor-fold desc="Public Methods">
23
  /**
24
   * @covers \Tfboe\FmLib\Exceptions\MethodNotExistingException::__construct
25
   */
26
  public function testConstructor()
27
  {
28
    $exc = new MethodNotExistingException("class", "method");
29
    self::assertEquals($exc->getMessage(), "An object of the class class had no method method");
30
    self::assertEquals(0, $exc->getCode());
31
  }
32
33
  /**
34
   * @covers \Tfboe\FmLib\Exceptions\MethodNotExistingException::getJsonMessage
35
   * @uses   \Tfboe\FmLib\Exceptions\MethodNotExistingException::__construct
36
   */
37
  public function testJsonMessage()
38
  {
39
    $exc = new MethodNotExistingException("class", "method");
40
    self::assertEquals(['message' => 'Missing method in object', 'className' => 'class', 'methodName' => 'method'],
41
      $exc->getJsonMessage());
42
  }
43
//</editor-fold desc="Public Methods">
44
}

tests/Unit/Exceptions/PropertyNotExistingExceptionTest.php 1 location

@@ 20-44 (lines=25) @@
17
 * Class AuthenticationExceptionTest
18
 * @package Tfboe\FmLib\Tests\Unit\Exceptions
19
 */
20
class PropertyNotExistingExceptionTest extends UnitTestCase
21
{
22
//<editor-fold desc="Public Methods">
23
  /**
24
   * @covers \Tfboe\FmLib\Exceptions\PropertyNotExistingException::__construct
25
   */
26
  public function testConstructor()
27
  {
28
    $exc = new PropertyNotExistingException("class", "property", "getProperty");
29
    self::assertEquals($exc->getMessage(), "An object of the class class had no property property via getProperty");
30
    self::assertEquals(0, $exc->getCode());
31
  }
32
33
  /**
34
   * @covers \Tfboe\FmLib\Exceptions\PropertyNotExistingException::getJsonMessage
35
   * @uses   \Tfboe\FmLib\Exceptions\PropertyNotExistingException::__construct
36
   */
37
  public function testJsonMessage()
38
  {
39
    $exc = new PropertyNotExistingException("class", "property", "getProperty");
40
    self::assertEquals(['message' => 'Missing property in object', 'className' => 'class', 'propertyName' => 'property',
41
      'accessorMethod' => 'getProperty'], $exc->getJsonMessage());
42
  }
43
//</editor-fold desc="Public Methods">
44
}

tests/Unit/Exceptions/ReferenceExceptionTest.php 1 location

@@ 20-44 (lines=25) @@
17
 * Class ValueNotValidTest
18
 * @package Tfboe\FmLib\Tests\Unit\Exceptions
19
 */
20
class ReferenceExceptionTest extends UnitTestCase
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
}

tests/Unit/Exceptions/UnorderedPhaseNumberExceptionTest.php 1 location

@@ 19-44 (lines=26) @@
16
 * Class ValueNotValidTest
17
 * @package Tfboe\FmLib\Tests\Unit\Exceptions
18
 */
19
class UnorderedPhaseNumberExceptionTest extends UnitTestCase
20
{
21
//<editor-fold desc="Public Methods">
22
  /**
23
   * @covers \Tfboe\FmLib\Exceptions\UnorderedPhaseNumberException::__construct
24
   */
25
  public function testConstructor()
26
  {
27
    $exc = new UnorderedPhaseNumberException(2, 1);
28
    self::assertEquals("The previous phase with number 2 has a higher phase number than the next phase with " .
29
      "number 1", $exc->getMessage());
30
    self::assertEquals(409, $exc->getCode());
31
  }
32
33
  /**
34
   * @covers \Tfboe\FmLib\Exceptions\UnorderedPhaseNumberException::getJsonMessage
35
   * @uses   \Tfboe\FmLib\Exceptions\UnorderedPhaseNumberException::__construct
36
   */
37
  public function testJsonMessage()
38
  {
39
    $exc = new UnorderedPhaseNumberException(2, 1);
40
    self::assertEquals(['message' => 'Unordered Phase Number Exception', 'previousPhaseNumber' => 2,
41
      'nextPhaseNumber' => 1], $exc->getJsonMessage());
42
  }
43
//</editor-fold desc="Public Methods">
44
}