ILIAS  trunk Revision v11.0_alpha-1753-gb21ca8c4367
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
PositiveIntegerTest.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
24 namespace ILIAS\Data;
25 
28 
29 require_once("vendor/composer/vendor/autoload.php");
30 
31 class PositiveIntegerTest extends TestCase
32 {
36  public function testCreatePositiveInteger(): void
37  {
38  $integer = new PositiveInteger(6);
39  $this->assertSame(6, $integer->getValue());
40  }
41 
42  public function testNegativeIntegerThrowsException(): void
43  {
44  $this->expectNotToPerformAssertions();
45 
46  try {
47  $integer = new PositiveInteger(-6);
48  } catch (ConstraintViolationException $exception) {
49  return;
50  }
51  $this->fail();
52  }
53 
57  public function testMaximumIntegerIsAccepted(): void
58  {
59  $integer = new PositiveInteger(PHP_INT_MAX);
60  $this->assertSame(PHP_INT_MAX, $integer->getValue());
61  }
62 }