Skip to content

Commit

Permalink
Before handler to facilitate #151
Browse files Browse the repository at this point in the history
  • Loading branch information
mevdschee committed Mar 12, 2017
1 parent 4cf339c commit 6710c04
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
Binary file modified data/blog.db
Binary file not shown.
4 changes: 2 additions & 2 deletions tests/blog_mysql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,11 @@ CREATE TABLE `products` (
`name` varchar(255) NOT NULL,
`price` decimal(10,2) NOT NULL,
`properties` JSON NOT NULL,
`created_at` datetime(3) NOT NULL,
`created_at` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

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');
(1, 'Calculator', '23.01', '{"depth":false,"model":"TRX-120","width":100,"height":null}', '1970-01-01 01:01:01');

-- 2016-11-05 13:11:47
2 changes: 1 addition & 1 deletion tests/blog_postgresql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ INSERT INTO "events" ("name", "datetime", "visitors") VALUES
--

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

--
-- Name: categories_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
Expand Down
2 changes: 1 addition & 1 deletion tests/blog_sqlite.sql
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,6 @@ CREATE TABLE `products` (
`created_at` datetime NOT NULL
);

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');
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');

--
4 changes: 2 additions & 2 deletions tests/blog_sqlserver.sql
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ CREATE TABLE [products](
[name] [nvarchar](max) NOT NULL,
[price] [decimal](10,2) NOT NULL,
[properties] [xml] NOT NULL,
[created_at] [datetime2](3) NOT NULL,
[created_at] [datetime] NOT NULL,
CONSTRAINT [PK_products] PRIMARY KEY CLUSTERED
(
[id] ASC
Expand Down Expand Up @@ -289,7 +289,7 @@ SET IDENTITY_INSERT [events] OFF
GO
SET IDENTITY_INSERT [products] ON
GO
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')
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')
GO
SET IDENTITY_INSERT [products] OFF
GO
Expand Down
4 changes: 2 additions & 2 deletions tests/tests.php
Original file line number Diff line number Diff line change
Expand Up @@ -785,9 +785,9 @@ public function testWriteProductProperties()
public function testAddProducts()
{
$test = new API($this);
$test->post('/products','{"name":"Laptop","price":"1299.99"}');
$test->post('/products','{"name":"Laptop","price":"1299.99","properties":{}}');
$test->expect('2');
$test->get('/products/2');
$test->expect('{"id":2,"name":"Laptop","price":"1299.99","properties":null,"created_at":"2013-12-11 10:09:08.000"}');
$test->expect('{"id":2,"name":"Laptop","price":"1299.99","properties":{},"created_at":"2013-12-11 10:09:08"}');
}
}

0 comments on commit 6710c04

Please sign in to comment.