ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
DataFactoryTest.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 2017 Stefan Hecken <stefan.hecken@concepts-and-training.de> Extended GPL, see docs/LICENSE */
3 
4 require_once("libs/composer/vendor/autoload.php");
5 
6 use ILIAS\Data;
7 
14 {
15  protected function setUp()
16  {
17  $this->f = new Data\Factory();
18  }
19 
20  protected function tearDown()
21  {
22  $this->f = null;
23  }
24 
25  public function testOk()
26  {
27  $result = $this->f->ok(3.154);
28  $this->assertInstanceOf(Data\Result::class, $result);
29  $this->assertTrue($result->isOk());
30  $this->assertFalse($result->isError());
31  }
32 
33  public function testError()
34  {
35  $result = $this->f->error("Something went wrong");
36  $this->assertInstanceOf(Data\Result::class, $result);
37  $this->assertTrue($result->isError());
38  $this->assertFalse($result->isOk());
39  }
40 
41  public function testPassword()
42  {
43  $pwd = $this->f->password("secret");
44  $this->assertInstanceOf(Data\Password::class, $pwd);
45  }
46 }
$result
Testing the faytory of result objects.