ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
PositiveIntegerTest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
24namespace ILIAS\Data;
25
27use PHPUnit\Framework\TestCase;
28
29require_once("vendor/composer/vendor/autoload.php");
30
31class 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}