ILIAS  release_7 Revision v7.30-3-g800a261c036
DataFactoryTest Class Reference

Testing the faytory of result objects. More...

+ Inheritance diagram for DataFactoryTest:
+ Collaboration diagram for DataFactoryTest:

Public Member Functions

 testOk ()
 
 testError ()
 
 testPassword ()
 
 testAlphanumeric ()
 
 testPositiveInteger ()
 
 testDataSize1 ()
 
 testDataSize2 ()
 

Protected Member Functions

 setUp ()
 
 tearDown ()
 

Private Attributes

 $f
 

Detailed Description

Testing the faytory of result objects.

Author
Stefan Hecken stefa.nosp@m.n.he.nosp@m.cken@.nosp@m.conc.nosp@m.epts-.nosp@m.and-.nosp@m.train.nosp@m.ing..nosp@m.de

Definition at line 14 of file DataFactoryTest.php.

Member Function Documentation

◆ setUp()

DataFactoryTest::setUp ( )
protected

Definition at line 22 of file DataFactoryTest.php.

22 : void
23 {
24 $this->f = new Data\Factory();
25 }

◆ tearDown()

DataFactoryTest::tearDown ( )
protected

Definition at line 27 of file DataFactoryTest.php.

27 : void
28 {
29 $this->f = null;
30 }

◆ testAlphanumeric()

DataFactoryTest::testAlphanumeric ( )

Definition at line 54 of file DataFactoryTest.php.

55 {
56 $dataType = $this->f->alphanumeric('someValue');
57 $this->assertInstanceOf(Data\Alphanumeric::class, $dataType);
58 }

◆ testDataSize1()

DataFactoryTest::testDataSize1 ( )

Definition at line 66 of file DataFactoryTest.php.

67 {
68 $dataType = $this->f->dataSize(10, "MB");
69 $this->assertInstanceOf(Data\DataSize::class, $dataType);
70 }

◆ testDataSize2()

DataFactoryTest::testDataSize2 ( )

Definition at line 72 of file DataFactoryTest.php.

73 {
74 $dataType = $this->f->dataSize("10G");
75 $this->assertEquals(10, $dataType->getSize());
76 $this->assertEquals(Data\DataSize::GiB, $dataType->getUnit());
77 $this->assertEquals(10 * Data\DataSize::GiB, $dataType->inBytes());
78 $this->assertInstanceOf(Data\DataSize::class, $dataType);
79 }

◆ testError()

DataFactoryTest::testError ( )

Definition at line 40 of file DataFactoryTest.php.

41 {
42 $result = $this->f->error("Something went wrong");
43 $this->assertInstanceOf(Data\Result::class, $result);
44 $this->assertTrue($result->isError());
45 $this->assertFalse($result->isOk());
46 }
$result

References $result.

◆ testOk()

DataFactoryTest::testOk ( )

Definition at line 32 of file DataFactoryTest.php.

33 {
34 $result = $this->f->ok(3.154);
35 $this->assertInstanceOf(Data\Result::class, $result);
36 $this->assertTrue($result->isOk());
37 $this->assertFalse($result->isError());
38 }

References $result.

◆ testPassword()

DataFactoryTest::testPassword ( )

Definition at line 48 of file DataFactoryTest.php.

49 {
50 $pwd = $this->f->password("secret");
51 $this->assertInstanceOf(Data\Password::class, $pwd);
52 }

◆ testPositiveInteger()

DataFactoryTest::testPositiveInteger ( )

Definition at line 60 of file DataFactoryTest.php.

61 {
62 $dataType = $this->f->positiveInteger(100);
63 $this->assertInstanceOf(Data\PositiveInteger::class, $dataType);
64 }

Field Documentation

◆ $f

DataFactoryTest::$f
private

Definition at line 20 of file DataFactoryTest.php.


The documentation for this class was generated from the following file: