ILIAS  release_7 Revision v7.30-3-g800a261c036
PositiveIntegerTest.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
3
8namespace ILIAS\Data;
9
11use PHPUnit\Framework\TestCase;
12
13require_once("libs/composer/vendor/autoload.php");
14
15class PositiveIntegerTest extends TestCase
16{
20 public function testCreatePositiveInteger()
21 {
22 $integer = new PositiveInteger(6);
23 $this->assertSame(6, $integer->getValue());
24 }
25
27 {
28 $this->expectNotToPerformAssertions();
29
30 try {
31 $integer = new PositiveInteger(-6);
32 } catch (ConstraintViolationException $exception) {
33 return;
34 }
35 $this->fail();
36 }
37
42 {
43 $integer = new PositiveInteger(PHP_INT_MAX);
44 $this->assertSame(PHP_INT_MAX, $integer->getValue());
45 }
46}
An exception for terminatinating execution or to throw for unit testing.