ILIAS  release_8 Revision v8.25
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

Data Factory $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 17 of file DataFactoryTest.php.

Member Function Documentation

◆ setUp()

DataFactoryTest::setUp ( )
protected

Definition at line 24 of file DataFactoryTest.php.

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

◆ tearDown()

DataFactoryTest::tearDown ( )
protected

Definition at line 29 of file DataFactoryTest.php.

29 : void
30 {
31 $this->f = null;
32 }

◆ testAlphanumeric()

DataFactoryTest::testAlphanumeric ( )

Definition at line 56 of file DataFactoryTest.php.

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

◆ testDataSize1()

DataFactoryTest::testDataSize1 ( )

Definition at line 68 of file DataFactoryTest.php.

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

◆ testDataSize2()

DataFactoryTest::testDataSize2 ( )

Definition at line 74 of file DataFactoryTest.php.

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

◆ testError()

DataFactoryTest::testError ( )

Definition at line 42 of file DataFactoryTest.php.

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

◆ testOk()

DataFactoryTest::testOk ( )

Definition at line 34 of file DataFactoryTest.php.

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

◆ testPassword()

DataFactoryTest::testPassword ( )

Definition at line 50 of file DataFactoryTest.php.

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

◆ testPositiveInteger()

DataFactoryTest::testPositiveInteger ( )

Definition at line 62 of file DataFactoryTest.php.

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

Field Documentation

◆ $f

Data Factory DataFactoryTest::$f
private

Definition at line 22 of file DataFactoryTest.php.


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