Skip to content

Commit 6710c04

Browse files
committed
Before handler to facilitate #151
1 parent 4cf339c commit 6710c04

File tree

6 files changed

+8
-8
lines changed

6 files changed

+8
-8
lines changed

data/blog.db

3 KB
Binary file not shown.

tests/blog_mysql.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,11 @@ CREATE TABLE `products` (
125125
`name` varchar(255) NOT NULL,
126126
`price` decimal(10,2) NOT NULL,
127127
`properties` JSON NOT NULL,
128-
`created_at` datetime(3) NOT NULL,
128+
`created_at` datetime NOT NULL,
129129
PRIMARY KEY (`id`)
130130
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
131131

132132
INSERT INTO `products` (`id`, `name`, `price`, `properties`, `created_at`) VALUES
133-
(1, 'Calculator', '23.01', '{"depth":false,"model":"TRX-120","width":100,"height":null}', '1970-01-01 01:01:01.001');
133+
(1, 'Calculator', '23.01', '{"depth":false,"model":"TRX-120","width":100,"height":null}', '1970-01-01 01:01:01');
134134

135135
-- 2016-11-05 13:11:47

tests/blog_postgresql.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ INSERT INTO "events" ("name", "datetime", "visitors") VALUES
206206
--
207207

208208
INSERT INTO "products" ("name", "price", "properties", "created_at") VALUES
209-
('Calculator', '23.01', '{"depth":false,"model":"TRX-120","width":100,"height":null}', '1970-01-01 01:01:01.001');
209+
('Calculator', '23.01', '{"depth":false,"model":"TRX-120","width":100,"height":null}', '1970-01-01 01:01:01');
210210

211211
--
212212
-- Name: categories_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:

tests/blog_sqlite.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,6 @@ CREATE TABLE `products` (
110110
`created_at` datetime NOT NULL
111111
);
112112

113-
INSERT INTO `products` (`id`, `name`, `price`, `properties`, `created_at`) VALUES (1, 'Calculator', '23.01', '{"depth":false,"model":"TRX-120","width":100,"height":null}', '1970-01-01 01:01:01.001');
113+
INSERT INTO `products` (`id`, `name`, `price`, `properties`, `created_at`) VALUES (1, 'Calculator', '23.01', '{"depth":false,"model":"TRX-120","width":100,"height":null}', '1970-01-01 01:01:01');
114114

115115
--

tests/blog_sqlserver.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ CREATE TABLE [products](
209209
[name] [nvarchar](max) NOT NULL,
210210
[price] [decimal](10,2) NOT NULL,
211211
[properties] [xml] NOT NULL,
212-
[created_at] [datetime2](3) NOT NULL,
212+
[created_at] [datetime] NOT NULL,
213213
CONSTRAINT [PK_products] PRIMARY KEY CLUSTERED
214214
(
215215
[id] ASC
@@ -289,7 +289,7 @@ SET IDENTITY_INSERT [events] OFF
289289
GO
290290
SET IDENTITY_INSERT [products] ON
291291
GO
292-
INSERT [products] ([id], [name], [price], [properties], [created_at]) VALUES (1, N'Calculator', N'23.01', N'<root type="object"><depth type="boolean">false</depth><model type="string">TRX-120</model><width type="number">100</width><height type="null" /></root>', '1970-01-01 01:01:01.001')
292+
INSERT [products] ([id], [name], [price], [properties], [created_at]) VALUES (1, N'Calculator', N'23.01', N'<root type="object"><depth type="boolean">false</depth><model type="string">TRX-120</model><width type="number">100</width><height type="null" /></root>', '1970-01-01 01:01:01')
293293
GO
294294
SET IDENTITY_INSERT [products] OFF
295295
GO

tests/tests.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -785,9 +785,9 @@ public function testWriteProductProperties()
785785
public function testAddProducts()
786786
{
787787
$test = new API($this);
788-
$test->post('/products','{"name":"Laptop","price":"1299.99"}');
788+
$test->post('/products','{"name":"Laptop","price":"1299.99","properties":{}}');
789789
$test->expect('2');
790790
$test->get('/products/2');
791-
$test->expect('{"id":2,"name":"Laptop","price":"1299.99","properties":null,"created_at":"2013-12-11 10:09:08.000"}');
791+
$test->expect('{"id":2,"name":"Laptop","price":"1299.99","properties":{},"created_at":"2013-12-11 10:09:08"}');
792792
}
793793
}

0 commit comments

Comments
 (0)