ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 ()
 
 testLanguageTag ()
 
 testLanguageTagFailed ()
 

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 33 of file DataFactoryTest.php.

Member Function Documentation

◆ setUp()

DataFactoryTest::setUp ( )
protected

Definition at line 40 of file DataFactoryTest.php.

40  : void
41  {
42  $this->f = new Data\Factory();
43  }

◆ tearDown()

DataFactoryTest::tearDown ( )
protected

Definition at line 45 of file DataFactoryTest.php.

References null.

45  : void
46  {
47  $this->f = null;
48  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ testAlphanumeric()

DataFactoryTest::testAlphanumeric ( )

Definition at line 72 of file DataFactoryTest.php.

72  : void
73  {
74  $dataType = $this->f->alphanumeric('someValue');
75  $this->assertInstanceOf(Data\Alphanumeric::class, $dataType);
76  }

◆ testDataSize1()

DataFactoryTest::testDataSize1 ( )

Definition at line 84 of file DataFactoryTest.php.

84  : void
85  {
86  $dataType = $this->f->dataSize(10, "MB");
87  $this->assertInstanceOf(Data\DataSize::class, $dataType);
88  }

◆ testDataSize2()

DataFactoryTest::testDataSize2 ( )

Definition at line 90 of file DataFactoryTest.php.

90  : void
91  {
92  $dataType = $this->f->dataSize("10G");
93  $this->assertEquals(10, $dataType->getSize());
94  $this->assertEquals(Data\DataSize::GiB, $dataType->getUnit());
95  $this->assertEquals(10 * Data\DataSize::GiB, $dataType->inBytes());
96  $this->assertInstanceOf(Data\DataSize::class, $dataType);
97  }

◆ testError()

DataFactoryTest::testError ( )

Definition at line 58 of file DataFactoryTest.php.

58  : void
59  {
60  $result = $this->f->error("Something went wrong");
61  $this->assertInstanceOf(Data\Result::class, $result);
62  $this->assertTrue($result->isError());
63  $this->assertFalse($result->isOk());
64  }

◆ testLanguageTag()

DataFactoryTest::testLanguageTag ( )

Definition at line 99 of file DataFactoryTest.php.

99  : void
100  {
101  $tag = $this->f->languageTag('de');
102  $this->assertInstanceOf(LanguageTag::class, $tag);
103  }

◆ testLanguageTagFailed()

DataFactoryTest::testLanguageTagFailed ( )

Definition at line 105 of file DataFactoryTest.php.

105  : void
106  {
107  $this->expectException(NotOKException::class);
108  $this->f->languageTag('d$');
109  }

◆ testOk()

DataFactoryTest::testOk ( )

Definition at line 50 of file DataFactoryTest.php.

50  : void
51  {
52  $result = $this->f->ok(3.154);
53  $this->assertInstanceOf(Data\Result::class, $result);
54  $this->assertTrue($result->isOk());
55  $this->assertFalse($result->isError());
56  }

◆ testPassword()

DataFactoryTest::testPassword ( )

Definition at line 66 of file DataFactoryTest.php.

66  : void
67  {
68  $pwd = $this->f->password("secret");
69  $this->assertInstanceOf(Data\Password::class, $pwd);
70  }

◆ testPositiveInteger()

DataFactoryTest::testPositiveInteger ( )

Definition at line 78 of file DataFactoryTest.php.

78  : void
79  {
80  $dataType = $this->f->positiveInteger(100);
81  $this->assertInstanceOf(Data\PositiveInteger::class, $dataType);
82  }

Field Documentation

◆ $f

Data Factory DataFactoryTest::$f
private

Definition at line 38 of file DataFactoryTest.php.


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