ILIAS  release_8 Revision v8.23
PositiveIntegerTest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
6 
11 namespace ILIAS\Data;
12 
15 
16 require_once("libs/composer/vendor/autoload.php");
17 
18 class PositiveIntegerTest extends TestCase
19 {
23  public function testCreatePositiveInteger(): void
24  {
25  $integer = new PositiveInteger(6);
26  $this->assertSame(6, $integer->getValue());
27  }
28 
29  public function testNegativeIntegerThrowsException(): void
30  {
31  $this->expectNotToPerformAssertions();
32 
33  try {
34  $integer = new PositiveInteger(-6);
35  } catch (ConstraintViolationException $exception) {
36  return;
37  }
38  $this->fail();
39  }
40 
44  public function testMaximumIntegerIsAccepted(): void
45  {
46  $integer = new PositiveInteger(PHP_INT_MAX);
47  $this->assertSame(PHP_INT_MAX, $integer->getValue());
48  }
49 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...