Browse Source

Use only second precision on dates in tests

Maurits van der Schee 8 years ago
parent
commit
67ac9da434
5 changed files with 10 additions and 10 deletions
  1. 2
    2
      tests/blog_mysql.sql
  2. 1
    1
      tests/blog_postgresql.sql
  3. 1
    1
      tests/blog_sqlite.sql
  4. 2
    2
      tests/blog_sqlserver.sql
  5. 4
    4
      tests/tests.php

+ 2
- 2
tests/blog_mysql.sql View File

@@ -108,13 +108,13 @@ DROP TABLE IF EXISTS `events`;
108 108
 CREATE TABLE `events` (
109 109
   `id` int(11) NOT NULL AUTO_INCREMENT,
110 110
   `name` varchar(255) NOT NULL,
111
-  `datetime` datetime(3) NOT NULL,
111
+  `datetime` datetime NOT NULL,
112 112
   `visitors` int(11) NOT NULL,
113 113
   PRIMARY KEY (`id`)
114 114
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
115 115
 
116 116
 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);
118 118
 
119 119
 DROP VIEW IF EXISTS `tag_usage`;
120 120
 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`;

+ 1
- 1
tests/blog_postgresql.sql View File

@@ -199,7 +199,7 @@ INSERT INTO "countries" ("name", "shape") VALUES
199 199
 --
200 200
 
201 201
 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);
203 203
 
204 204
 --
205 205
 -- Data for Name: events; Type: TABLE DATA; Schema: public; Owner: postgres

+ 1
- 1
tests/blog_sqlite.sql View File

@@ -96,7 +96,7 @@ CREATE TABLE `events` (
96 96
   `visitors` integer NOT NULL
97 97
 );
98 98
 
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);
100 100
 
101 101
 DROP VIEW IF EXISTS `tag_usage`;
102 102
 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`;

+ 2
- 2
tests/blog_sqlserver.sql View File

@@ -182,7 +182,7 @@ GO
182 182
 CREATE TABLE [events](
183 183
 	[id] [int] IDENTITY,
184 184
 	[name] [nvarchar](max) NOT NULL,
185
-	[datetime] [datetime2](3) NOT NULL,
185
+	[datetime] [datetime] NOT NULL,
186 186
 	[visitors] [int] NOT NULL,
187 187
  CONSTRAINT [PK_events] PRIMARY KEY CLUSTERED
188 188
 (
@@ -283,7 +283,7 @@ SET IDENTITY_INSERT [countries] OFF
283 283
 GO
284 284
 SET IDENTITY_INSERT [events] ON
285 285
 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)
287 287
 GO
288 288
 SET IDENTITY_INSERT [events] OFF
289 289
 GO

+ 4
- 4
tests/tests.php View File

@@ -677,7 +677,7 @@ class PHP_CRUD_API_Test extends PHPUnit_Framework_TestCase
677 677
 	{
678 678
 		$test = new API($this);
679 679
 		$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"]]}}');
681 681
 	}
682 682
 
683 683
 	public function testIncrementEventVisitors()
@@ -686,7 +686,7 @@ class PHP_CRUD_API_Test extends PHPUnit_Framework_TestCase
686 686
 		$test->patch('/events/1','{"visitors":11}');
687 687
 		$test->expect('1');
688 688
 		$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}');
690 690
 	}
691 691
 
692 692
 	public function testIncrementEventVisitorsWithZero()
@@ -695,7 +695,7 @@ class PHP_CRUD_API_Test extends PHPUnit_Framework_TestCase
695 695
 		$test->patch('/events/1','{"visitors":0}');
696 696
 		$test->expect('1');
697 697
 		$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}');
699 699
 	}
700 700
 
701 701
 	public function testDecrementEventVisitors()
@@ -704,7 +704,7 @@ class PHP_CRUD_API_Test extends PHPUnit_Framework_TestCase
704 704
 		$test->patch('/events/1','{"visitors":-5}');
705 705
 		$test->expect('1');
706 706
 		$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}');
708 708
 	}
709 709
 
710 710
 	public function testListTagUsage()

Loading…
Cancel
Save