ILIAS  release_7 Revision v7.30-3-g800a261c036
ArrayArtifactTest.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 2019 Richard Klees <richard.klees@concepts-and-training.de> Extended GPL, see docs/LICENSE */
4 
6 
9 
11 {
12  public function testSerialize() : void
13  {
14  $data = [
15  "one" => 1,
16  "two" => 2,
17  "nested" => [
18  "array" => "are nice"
19  ]
20  ];
21 
22  $a = new Artifact\ArrayArtifact($data);
23 
24  $serialized = $a->serialize();
25 
26  $this->assertEquals($data, eval("?>" . $serialized));
27  }
28 
29  public function testOnlyPrimitives() : void
30  {
31  $this->expectException(\InvalidArgumentException::class);
32 
33  $data = [ $this ];
34 
35  new Artifact\ArrayArtifact($data);
36  }
37 }
$data
Definition: storeScorm.php:23
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples