Skip to content

Commit 3927ee4

Browse files
committed
use more precise testing
1 parent b9d7809 commit 3927ee4

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

tests/Phinx/Db/Adapter/MysqlAdapterTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2237,8 +2237,8 @@ public function testBulkInsertDates()
22372237
$rows = $this->adapter->fetchAll('SELECT * FROM table1');
22382238
$this->assertEquals('foo', $rows[0]['name']);
22392239
$this->assertEquals('bar', $rows[1]['name']);
2240-
$this->assertMatchesRegularExpression('/[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}/', $rows[0]['created']);
2241-
$this->assertMatchesRegularExpression('/[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}/', $rows[1]['created']);
2240+
$this->assertMatchesRegularExpression($data[0]['created']->toDateTimeString(), $rows[0]['created']);
2241+
$this->assertMatchesRegularExpression($data[1]['created']->toDateTimeString(), $rows[1]['created']);
22422242
}
22432243

22442244
public function testInsertData()

tests/Phinx/Db/Adapter/PostgresAdapterTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2469,8 +2469,8 @@ public function testBulkInsertDates()
24692469
$rows = $this->adapter->fetchAll('SELECT * FROM table1');
24702470
$this->assertEquals('foo', $rows[0]['name']);
24712471
$this->assertEquals('bar', $rows[1]['name']);
2472-
$this->assertMatchesRegularExpression('/[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}/', $rows[0]['created']);
2473-
$this->assertMatchesRegularExpression('/[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}/', $rows[1]['created']);
2472+
$this->assertMatchesRegularExpression($data[0]['created']->toDateTimeString(), $rows[0]['created']);
2473+
$this->assertMatchesRegularExpression($data[1]['created']->toDateTimeString(), $rows[1]['created']);
24742474
}
24752475

24762476
public function testInsertData()

tests/Phinx/Db/Adapter/SQLiteAdapterTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1923,8 +1923,8 @@ public function testBulkInsertDates()
19231923
$rows = $this->adapter->fetchAll('SELECT * FROM table1');
19241924
$this->assertEquals('foo', $rows[0]['name']);
19251925
$this->assertEquals('bar', $rows[1]['name']);
1926-
$this->assertMatchesRegularExpression('/[0-9]{4}-[0-9]{2}-[0-9]{2}/', $rows[0]['created']);
1927-
$this->assertMatchesRegularExpression('/[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}/', $rows[1]['created']);
1926+
$this->assertMatchesRegularExpression($data[0]['created']->toDateString(), $rows[0]['created']);
1927+
$this->assertMatchesRegularExpression($data[1]['created']->toDateTimeString(), $rows[1]['created']);
19281928
}
19291929

19301930
public function testNullWithoutDefaultValue()

tests/Phinx/Db/Adapter/SqlServerAdapterTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1367,8 +1367,8 @@ public function testBulkInsertDates()
13671367
$rows = $this->adapter->fetchAll('SELECT * FROM table1');
13681368
$this->assertEquals('foo', $rows[0]['name']);
13691369
$this->assertEquals('bar', $rows[1]['name']);
1370-
$this->assertMatchesRegularExpression('/[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}/', $rows[0]['created']);
1371-
$this->assertMatchesRegularExpression('/[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}/', $rows[1]['created']);
1370+
$this->assertMatchesRegularExpression($data[0]['created']->toDateTimeString(), $rows[0]['created']);
1371+
$this->assertMatchesRegularExpression($data[1]['created']->toDateTimeString(), $rows[1]['created']);
13721372
}
13731373

13741374
public function testInsertData()

0 commit comments

Comments
 (0)