ILIAS  trunk Revision v12.0_alpha-1540-g00f839d5fa1
PositiveIntegerTest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
25namespace ILIAS\Data;
26
28use PHPUnit\Framework\TestCase;
29
30require_once("vendor/composer/vendor/autoload.php");
31
32class PositiveIntegerTest extends TestCase
33{
37 public function testCreatePositiveInteger(): void
38 {
39 $integer = new PositiveInteger(6);
40 $this->assertSame(6, $integer->getValue());
41 }
42
43 public function testNegativeIntegerThrowsException(): void
44 {
45 $this->expectNotToPerformAssertions();
46
47 try {
48 $integer = new PositiveInteger(-6);
49 } catch (ConstraintViolationException $exception) {
50 return;
51 }
52 $this->fail();
53 }
54
58 public function testMaximumIntegerIsAccepted(): void
59 {
60 $integer = new PositiveInteger(PHP_INT_MAX);
61 $this->assertSame(PHP_INT_MAX, $integer->getValue());
62 }
63}