|
4 | 4 |
|
5 | 5 | class InsertTest extends \PHPUnit\Framework\TestCase
|
6 | 6 | {
|
| 7 | + public function testDateNullInsert() : void |
| 8 | + { |
| 9 | + $transaction = new \PHPFUI\ORM\Transaction(); |
| 10 | + $test = new \Tests\App\Record\DateRecord(); |
| 11 | + $test->dateRequired = $date = \date('Y-m-d'); |
| 12 | + $timeStamp = \date('Y-m-d H:i:s'); |
| 13 | + $id = $test->insert(); |
| 14 | + $insertedTest = new \Tests\App\Record\DateRecord($id); |
| 15 | + $this->assertNull($insertedTest->dateDefaultNull); |
| 16 | + $this->assertEquals($date, $insertedTest->dateRequired); |
| 17 | + $this->assertEquals('2000-01-02', $insertedTest->dateDefaultNullable); |
| 18 | + $this->assertEquals('2000-01-02', $insertedTest->dateDefaultNotNull); |
| 19 | + $this->assertGreaterThanOrEqual($timeStamp, $insertedTest->timestampDefaultCurrentNullable); |
| 20 | + $this->assertGreaterThanOrEqual($timeStamp, $insertedTest->timestampDefaultCurrentNotNull); |
| 21 | + |
| 22 | + $this->assertTrue($transaction->rollBack()); |
| 23 | + } |
| 24 | + |
| 25 | + public function testDateRequiredInsert() : void |
| 26 | + { |
| 27 | + $this->expectException(\Exception::class); |
| 28 | + $transaction = new \PHPFUI\ORM\Transaction(); |
| 29 | + $test = new \Tests\App\Record\DateRecord(); |
| 30 | + $id = $test->insert(); |
| 31 | + $insertedTest = new \Tests\App\Record\DateRecord($id); |
| 32 | + $this->assertNull($insertedTest->dateDefaultNull); |
| 33 | + $this->assertEquals('2000-01-02', $insertedTest->dateDefaultNullable); |
| 34 | + $this->assertEquals('2000-01-02', $insertedTest->dateDefaultNotNull); |
| 35 | + $this->assertTrue($transaction->rollBack()); |
| 36 | + } |
| 37 | + |
7 | 38 | public function testMultipleInserts() : void
|
8 | 39 | {
|
9 | 40 | $transaction = new \PHPFUI\ORM\Transaction();
|
@@ -73,37 +104,6 @@ public function testMultipleInserts() : void
|
73 | 104 | $this->assertCount(29, $customerTable);
|
74 | 105 | }
|
75 | 106 |
|
76 |
| - public function testDateNullInsert() : void |
77 |
| - { |
78 |
| - $transaction = new \PHPFUI\ORM\Transaction(); |
79 |
| - $test = new \Tests\App\Record\DateRecord(); |
80 |
| - $test->dateRequired = $date = \date('Y-m-d'); |
81 |
| - $timeStamp = \date('Y-m-d H:i:s'); |
82 |
| - $id = $test->insert(); |
83 |
| - $insertedTest = new \Tests\App\Record\DateRecord($id); |
84 |
| - $this->assertNull($insertedTest->dateDefaultNull); |
85 |
| - $this->assertEquals($date, $insertedTest->dateRequired); |
86 |
| - $this->assertEquals('2000-01-02', $insertedTest->dateDefaultNullable); |
87 |
| - $this->assertEquals('2000-01-02', $insertedTest->dateDefaultNotNull); |
88 |
| - $this->assertGreaterThanOrEqual($timeStamp, $insertedTest->timestampDefaultCurrentNullable); |
89 |
| - $this->assertGreaterThanOrEqual($timeStamp, $insertedTest->timestampDefaultCurrentNotNull); |
90 |
| - |
91 |
| - $this->assertTrue($transaction->rollBack()); |
92 |
| - } |
93 |
| - |
94 |
| - public function testDateRequiredInsert() : void |
95 |
| - { |
96 |
| - $this->expectException(\Exception::class); |
97 |
| - $transaction = new \PHPFUI\ORM\Transaction(); |
98 |
| - $test = new \Tests\App\Record\DateRecord(); |
99 |
| - $id = $test->insert(); |
100 |
| - $insertedTest = new \Tests\App\Record\DateRecord($id); |
101 |
| - $this->assertNull($insertedTest->dateDefaultNull); |
102 |
| - $this->assertEquals('2000-01-02', $insertedTest->dateDefaultNullable); |
103 |
| - $this->assertEquals('2000-01-02', $insertedTest->dateDefaultNotNull); |
104 |
| - $this->assertTrue($transaction->rollBack()); |
105 |
| - } |
106 |
| - |
107 | 107 | public function testRecordInsert() : void
|
108 | 108 | {
|
109 | 109 | $customer = new \Tests\App\Record\Customer();
|
|
0 commit comments