Before handler to facilitate #151
This commit is contained in:
parent
4cf339c9ea
commit
6710c042f9
6 changed files with 8 additions and 8 deletions
BIN
data/blog.db
BIN
data/blog.db
Binary file not shown.
|
|
@ -125,11 +125,11 @@ CREATE TABLE `products` (
|
||||||
`name` varchar(255) NOT NULL,
|
`name` varchar(255) NOT NULL,
|
||||||
`price` decimal(10,2) NOT NULL,
|
`price` decimal(10,2) NOT NULL,
|
||||||
`properties` JSON NOT NULL,
|
`properties` JSON NOT NULL,
|
||||||
`created_at` datetime(3) NOT NULL,
|
`created_at` datetime NOT NULL,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||||
|
|
||||||
INSERT INTO `products` (`id`, `name`, `price`, `properties`, `created_at`) VALUES
|
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
|
-- 2016-11-05 13:11:47
|
||||||
|
|
|
||||||
|
|
@ -206,7 +206,7 @@ INSERT INTO "events" ("name", "datetime", "visitors") VALUES
|
||||||
--
|
--
|
||||||
|
|
||||||
INSERT INTO "products" ("name", "price", "properties", "created_at") 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:
|
-- Name: categories_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace:
|
||||||
|
|
|
||||||
|
|
@ -110,6 +110,6 @@ CREATE TABLE `products` (
|
||||||
`created_at` datetime NOT NULL
|
`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');
|
||||||
|
|
||||||
--
|
--
|
||||||
|
|
|
||||||
|
|
@ -209,7 +209,7 @@ CREATE TABLE [products](
|
||||||
[name] [nvarchar](max) NOT NULL,
|
[name] [nvarchar](max) NOT NULL,
|
||||||
[price] [decimal](10,2) NOT NULL,
|
[price] [decimal](10,2) NOT NULL,
|
||||||
[properties] [xml] NOT NULL,
|
[properties] [xml] NOT NULL,
|
||||||
[created_at] [datetime2](3) NOT NULL,
|
[created_at] [datetime] NOT NULL,
|
||||||
CONSTRAINT [PK_products] PRIMARY KEY CLUSTERED
|
CONSTRAINT [PK_products] PRIMARY KEY CLUSTERED
|
||||||
(
|
(
|
||||||
[id] ASC
|
[id] ASC
|
||||||
|
|
@ -289,7 +289,7 @@ SET IDENTITY_INSERT [events] OFF
|
||||||
GO
|
GO
|
||||||
SET IDENTITY_INSERT [products] ON
|
SET IDENTITY_INSERT [products] ON
|
||||||
GO
|
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
|
GO
|
||||||
SET IDENTITY_INSERT [products] OFF
|
SET IDENTITY_INSERT [products] OFF
|
||||||
GO
|
GO
|
||||||
|
|
|
||||||
|
|
@ -785,9 +785,9 @@ class PHP_CRUD_API_Test extends PHPUnit_Framework_TestCase
|
||||||
public function testAddProducts()
|
public function testAddProducts()
|
||||||
{
|
{
|
||||||
$test = new API($this);
|
$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->expect('2');
|
||||||
$test->get('/products/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"}');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue