Skip to content

Commit 67ac9da

Browse files
committed
Use only second precision on dates in tests
1 parent e05752c commit 67ac9da

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

tests/blog_mysql.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,13 @@ DROP TABLE IF EXISTS `events`;
108108
CREATE TABLE `events` (
109109
`id` int(11) NOT NULL AUTO_INCREMENT,
110110
`name` varchar(255) NOT NULL,
111-
`datetime` datetime(3) NOT NULL,
111+
`datetime` datetime NOT NULL,
112112
`visitors` int(11) NOT NULL,
113113
PRIMARY KEY (`id`)
114114
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
115115

116116
INSERT INTO `events` (`id`, `name`, `datetime`, `visitors`) VALUES
117-
(1, 'Launch', '2016-01-01 13:01:01.111', 0);
117+
(1, 'Launch', '2016-01-01 13:01:01', 0);
118118

119119
DROP VIEW IF EXISTS `tag_usage`;
120120
CREATE VIEW `tag_usage` AS select `name`, count(`name`) AS `count` from `tags`, `post_tags` where `tags`.`id` = `post_tags`.`tag_id` group by `name` order by `count` desc, `name`;

tests/blog_postgresql.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ INSERT INTO "countries" ("name", "shape") VALUES
199199
--
200200

201201
INSERT INTO "events" ("name", "datetime", "visitors") VALUES
202-
('Launch', '2016-01-01 13:01:01.111', 0);
202+
('Launch', '2016-01-01 13:01:01', 0);
203203

204204
--
205205
-- Data for Name: events; Type: TABLE DATA; Schema: public; Owner: postgres

tests/blog_sqlite.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ CREATE TABLE `events` (
9696
`visitors` integer NOT NULL
9797
);
9898

99-
INSERT INTO `events` (`id`, `name`, `datetime`, `visitors`) VALUES (1, 'Launch', '2016-01-01 13:01:01.111', 0);
99+
INSERT INTO `events` (`id`, `name`, `datetime`, `visitors`) VALUES (1, 'Launch', '2016-01-01 13:01:01', 0);
100100

101101
DROP VIEW IF EXISTS `tag_usage`;
102102
CREATE VIEW `tag_usage` AS select `name`, count(`name`) AS `count` from `tags`, `post_tags` where `tags`.`id` = `post_tags`.`tag_id` group by `name` order by `count` desc, `name`;

tests/blog_sqlserver.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ GO
182182
CREATE TABLE [events](
183183
[id] [int] IDENTITY,
184184
[name] [nvarchar](max) NOT NULL,
185-
[datetime] [datetime2](3) NOT NULL,
185+
[datetime] [datetime] NOT NULL,
186186
[visitors] [int] NOT NULL,
187187
CONSTRAINT [PK_events] PRIMARY KEY CLUSTERED
188188
(
@@ -283,7 +283,7 @@ SET IDENTITY_INSERT [countries] OFF
283283
GO
284284
SET IDENTITY_INSERT [events] ON
285285
GO
286-
INSERT [events] ([id], [name], [datetime], [visitors]) VALUES (1, N'Launch', N'2016-01-01 13:01:01.111', 0)
286+
INSERT [events] ([id], [name], [datetime], [visitors]) VALUES (1, N'Launch', N'2016-01-01 13:01:01', 0)
287287
GO
288288
SET IDENTITY_INSERT [events] OFF
289289
GO

tests/tests.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,7 @@ public function testListEvents()
677677
{
678678
$test = new API($this);
679679
$test->get('/events?columns=datetime');
680-
$test->expect('{"events":{"columns":["datetime"],"records":[["2016-01-01 13:01:01.111"]]}}');
680+
$test->expect('{"events":{"columns":["datetime"],"records":[["2016-01-01 13:01:01"]]}}');
681681
}
682682

683683
public function testIncrementEventVisitors()
@@ -686,7 +686,7 @@ public function testIncrementEventVisitors()
686686
$test->patch('/events/1','{"visitors":11}');
687687
$test->expect('1');
688688
$test->get('/events/1');
689-
$test->expect('{"id":1,"name":"Launch","datetime":"2016-01-01 13:01:01.111","visitors":11}');
689+
$test->expect('{"id":1,"name":"Launch","datetime":"2016-01-01 13:01:01","visitors":11}');
690690
}
691691

692692
public function testIncrementEventVisitorsWithZero()
@@ -695,7 +695,7 @@ public function testIncrementEventVisitorsWithZero()
695695
$test->patch('/events/1','{"visitors":0}');
696696
$test->expect('1');
697697
$test->get('/events/1');
698-
$test->expect('{"id":1,"name":"Launch","datetime":"2016-01-01 13:01:01.111","visitors":11}');
698+
$test->expect('{"id":1,"name":"Launch","datetime":"2016-01-01 13:01:01","visitors":11}');
699699
}
700700

701701
public function testDecrementEventVisitors()
@@ -704,7 +704,7 @@ public function testDecrementEventVisitors()
704704
$test->patch('/events/1','{"visitors":-5}');
705705
$test->expect('1');
706706
$test->get('/events/1');
707-
$test->expect('{"id":1,"name":"Launch","datetime":"2016-01-01 13:01:01.111","visitors":6}');
707+
$test->expect('{"id":1,"name":"Launch","datetime":"2016-01-01 13:01:01","visitors":6}');
708708
}
709709

710710
public function testListTagUsage()

0 commit comments

Comments
 (0)