ILIAS  trunk Revision v11.0_alpha-1769-g99a433fe2dc
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
AlphanumericTest.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 AlphanumericTest extends TestCase
32 {
34  {
35  $value = new Alphanumeric('hello');
36 
37  $this->assertSame('hello', $value->asString());
38  }
39 
41  {
42  $value = new Alphanumeric(6);
43 
44  $this->assertSame('6', $value->asString());
45  }
46 
47  public function testIntegerIsAlphanumericValue(): void
48  {
49  $value = new Alphanumeric(6);
50 
51  $this->assertSame(6, $value->getValue());
52  }
53 
55  {
56  $value = new Alphanumeric(6.0);
57 
58  $this->assertSame('6', $value->asString());
59  }
60 
61  public function testFloatIsAlphanumericValue(): void
62  {
63  $value = new Alphanumeric(6.0);
64 
65  $this->assertSame(6.0, $value->getValue());
66  }
67 
69  {
70  $this->expectNotToPerformAssertions();
71 
72  try {
73  $value = new Alphanumeric('hello world');
74  } catch (ConstraintViolationException $exception) {
75  return;
76  }
77  $this->fail();
78  }
79 }
testSimpleStringIsCorrectAlphanumericValueAndCanBeConvertedToString()