| @@ 52-60 (lines=9) @@ | ||
| 49 | } |
|
| 50 | ||
| 51 | ||
| 52 | public function testStringValue() |
|
| 53 | {
|
|
| 54 | $string = 'lorem ipsum'; |
|
| 55 | $field = new Field(1, $string); |
|
| 56 | $this->assertArrayHasKey('fvalueString', $field->toArray());
|
|
| 57 | $this->assertSame($field->toArray()['fvalueString'], $string); |
|
| 58 | $this->assertSame($field->getValue(), $string); |
|
| 59 | ||
| 60 | } |
|
| 61 | ||
| 62 | /** |
|
| 63 | * Tests integer value representation |
|
| @@ 66-73 (lines=8) @@ | ||
| 63 | * Tests integer value representation |
|
| 64 | * @return void |
|
| 65 | */ |
|
| 66 | public function testIntegerValue() |
|
| 67 | {
|
|
| 68 | $int = 10; |
|
| 69 | $field = new Field(1, $int); |
|
| 70 | $this->assertArrayHasKey('fvalueInt', $field->toArray());
|
|
| 71 | $this->assertSame($field->toArray()['fvalueInt'], $int); |
|
| 72 | $this->assertSame($field->getValue(), $int); |
|
| 73 | } |
|
| 74 | ||
| 75 | ||
| 76 | /** |
|
| @@ 80-87 (lines=8) @@ | ||
| 77 | * Tests float value representation |
|
| 78 | * @return void |
|
| 79 | */ |
|
| 80 | public function testFloatValue() |
|
| 81 | {
|
|
| 82 | $float = 13.5; |
|
| 83 | $field = new Field(1, $float); |
|
| 84 | $this->assertArrayHasKey('fvalueFloat', $field->toArray());
|
|
| 85 | $this->assertSame($field->toArray()['fvalueFloat'], $float); |
|
| 86 | $this->assertSame($field->getValue(), $float); |
|
| 87 | } |
|
| 88 | ||
| 89 | ||
| 90 | /** |
|
| @@ 94-101 (lines=8) @@ | ||
| 91 | * Tests date value representation |
|
| 92 | * @return void |
|
| 93 | */ |
|
| 94 | public function testDateValue() |
|
| 95 | {
|
|
| 96 | $date = '01-03-2017'; |
|
| 97 | $field = new Field(1, $date); |
|
| 98 | $this->assertArrayHasKey('fvalueDate', $field->toArray());
|
|
| 99 | $this->assertSame($field->toArray()['fvalueDate'], $date); |
|
| 100 | $this->assertSame($field->getValue(), $date); |
|
| 101 | } |
|
| 102 | ||
| 103 | ||
| 104 | /** |
|
| @@ 108-115 (lines=8) @@ | ||
| 105 | * Test forced value type - datetime |
|
| 106 | * @return void |
|
| 107 | */ |
|
| 108 | public function testDatetimeValue() |
|
| 109 | {
|
|
| 110 | $datetime = time(); |
|
| 111 | $field = new Field(1, $datetime, 'fvalueDatetime'); |
|
| 112 | $this->assertArrayHasKey('fvalueDatetime', $field->toArray());
|
|
| 113 | $this->assertSame($field->toArray()['fvalueDatetime'], $datetime); |
|
| 114 | $this->assertSame($field->getValue(), $datetime); |
|
| 115 | } |
|
| 116 | ||
| 117 | /** |
|
| 118 | * @expectedException Radowoj\Yaah\Exception |
|