Skip to content

Commit

Permalink
Amélioration des booléens dans les fixtures
Browse files Browse the repository at this point in the history
  • Loading branch information
Donov4n committed Dec 29, 2020
1 parent acbb5cf commit 57993a9
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 39 deletions.
2 changes: 2 additions & 0 deletions server/tests/Fixtures/RobertDataseed.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ private function _formatValue($value)
$value = "NULL";
} elseif (is_array($value)) {
$value = sprintf('"%s"', addslashes(json_encode($value)));
} elseif (is_bool($value)) {
$value = sprintf('%s', $value ? 1 : 0);
} else {
$value = sprintf('"%s"', addslashes((string)$value));
}
Expand Down
8 changes: 4 additions & 4 deletions server/tests/Fixtures/seed/bills.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"stock_quantity" : 5,
"out_of_order_quantity" : 1,
"replacement_price" : 19400,
"is_hidden_on_bill" : 0,
"is_discountable" : 0
"is_hidden_on_bill" : false,
"is_discountable" : false
},
{
"id" : 2,
Expand All @@ -30,8 +30,8 @@
"stock_quantity" : 2,
"out_of_order_quantity" : null,
"replacement_price" : 349.9,
"is_hidden_on_bill" : 0,
"is_discountable" : 1
"is_hidden_on_bill" : false,
"is_discountable" : true
}
],
"degressive_rate" : 1.75,
Expand Down
16 changes: 8 additions & 8 deletions server/tests/Fixtures/seed/events.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"description" : null,
"start_date" : "2018-12-17 00:00:00",
"end_date" : "2018-12-18 23:59:59",
"is_confirmed" : 0,
"is_confirmed" : false,
"location" : "Gap",
"is_billable" : 1
"is_billable" : true
},
{
"id" : 2,
Expand All @@ -17,9 +17,9 @@
"description" : null,
"start_date" : "2018-12-18 00:00:00",
"end_date" : "2018-12-19 23:59:59",
"is_confirmed" : 0,
"is_confirmed" : false,
"location" : "Lyon",
"is_billable" : 1
"is_billable" : true
},
{
"id" : 3,
Expand All @@ -28,9 +28,9 @@
"description" : null,
"start_date" : "2018-12-15 00:00:00",
"end_date" : "2018-12-16 23:59:59",
"is_confirmed" : 0,
"is_confirmed" : false,
"location" : "Brousse",
"is_billable" : 0
"is_billable" : false
},
{
"id" : 4,
Expand All @@ -39,8 +39,8 @@
"description" : null,
"start_date" : "2019-03-01 00:00:00",
"end_date" : "2019-02-10 23:59:59",
"is_confirmed" : 0,
"is_confirmed" : false,
"location" : "Moon",
"is_billable" : 0
"is_billable" : false
}
]
8 changes: 4 additions & 4 deletions server/tests/Fixtures/seed/material_units.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,24 @@
"id": 1,
"material_id": 6,
"serial_number": "XR18-1",
"is_broken": 0
"is_broken": false
},
{
"id": 2,
"material_id": 6,
"serial_number": "XR18-2",
"is_broken": 0
"is_broken": false
},
{
"id": 3,
"material_id": 6,
"serial_number": "XR18-3",
"is_broken": 1
"is_broken": true
},
{
"id": 4,
"material_id": 7,
"serial_number": "VHCL-1",
"is_broken": 0
"is_broken": false
}
]
40 changes: 20 additions & 20 deletions server/tests/Fixtures/seed/materials.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"id" : 1,
"name" : "Console Yamaha CL3",
"reference" : "CL3",
"is_unitary" : 0,
"is_unitary" : false,
"description" : "Console numérique 64 entrées / 8 sorties + Master + Sub",
"park_id" : 1,
"category_id" : 1,
Expand All @@ -12,8 +12,8 @@
"stock_quantity" : 5,
"out_of_order_quantity" : 1,
"replacement_price" : 19400,
"is_hidden_on_bill" : 0,
"is_discountable" : 0,
"is_hidden_on_bill" : false,
"is_discountable" : false,
"note" : null
},
{
Expand All @@ -29,15 +29,15 @@
"stock_quantity" : 2,
"out_of_order_quantity" : null,
"replacement_price" : 349.9,
"is_hidden_on_bill" : 0,
"is_discountable" : 1,
"is_hidden_on_bill" : false,
"is_discountable" : true,
"note" : null
},
{
"id" : 3,
"name" : "PAR64 LED",
"reference" : "PAR64LED",
"is_unitary" : 0,
"is_unitary" : false,
"description" : "Projecteur PAR64 à LED, avec son set de gélatines",
"park_id" : 1,
"category_id" : 2,
Expand All @@ -46,15 +46,15 @@
"stock_quantity" : 34,
"out_of_order_quantity" : 4,
"replacement_price" : 89,
"is_hidden_on_bill" : 0,
"is_discountable" : 1,
"is_hidden_on_bill" : false,
"is_discountable" : true,
"note" : "Soyez délicats avec ces projos !"
},
{
"id" : 4,
"name" : "Showtec SDS-6",
"reference" : "SDS-6-01",
"is_unitary" : 0,
"is_unitary" : false,
"description" : "Console DMX (jeu d'orgue) Showtec 6 canaux",
"park_id" : 1,
"category_id" : 2,
Expand All @@ -63,15 +63,15 @@
"stock_quantity" : 2,
"out_of_order_quantity" : null,
"replacement_price" : 59,
"is_hidden_on_bill" : 0,
"is_discountable" : 1,
"is_hidden_on_bill" : false,
"is_discountable" : true,
"note" : null
},
{
"id" : 5,
"name" : "Câble XLR 10m",
"reference" : "XLR10",
"is_unitary" : 0,
"is_unitary" : false,
"description" : "Câble audio XLR 10 mètres, mâle-femelle",
"park_id" : 1,
"category_id" : 1,
Expand All @@ -80,15 +80,15 @@
"stock_quantity" : 40,
"out_of_order_quantity" : 8,
"replacement_price" : 9.5,
"is_hidden_on_bill" : 1,
"is_discountable" : 1,
"is_hidden_on_bill" : true,
"is_discountable" : true,
"note" : null
},
{
"id" : 6,
"name" : "Behringer X Air XR18",
"reference" : "XR18",
"is_unitary" : 1,
"is_unitary" : true,
"description" : "Mélangeur numérique 18 canaux",
"park_id" : null,
"category_id" : 1,
Expand All @@ -97,15 +97,15 @@
"stock_quantity" : null,
"out_of_order_quantity" : null,
"replacement_price" : 419,
"is_hidden_on_bill" : 0,
"is_discountable" : 0,
"is_hidden_on_bill" : false,
"is_discountable" : false,
"note" : null
},
{
"id" : 7,
"name" : "Volkswagen Transporter",
"reference" : "Transporter",
"is_unitary" : 1,
"is_unitary" : true,
"description" : "Volume utile : 9.3 m3",
"park_id" : null,
"category_id" : 3,
Expand All @@ -114,8 +114,8 @@
"stock_quantity" : null,
"out_of_order_quantity" : null,
"replacement_price" : 32000,
"is_hidden_on_bill" : 0,
"is_discountable" : 0,
"is_hidden_on_bill" : false,
"is_discountable" : false,
"note" : null
}
]
4 changes: 2 additions & 2 deletions server/tests/Fixtures/seed/users.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
"pseudo" : "test2",
"group_id" : "member",
"email" : "tester2@robertmanager.net",
"password" : ""
"password" : "$2y$10$VkEmVCo1wNxcfebjiOp50OHsdSzRPEqZA9MROgeS2pw5fqHIUCq16"
},
{
"id" : 3,
"pseudo" : "nobody",
"group_id" : "member",
"email" : "nobody@robertmanager.net",
"password" : ""
"password" : "$2y$10$VkEmVCo1wNxcfebjiOp50OHsdSzRPEqZA9MROgeS2pw5fqHIUCq16"
}
]
2 changes: 1 addition & 1 deletion server/tests/models/UserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ public function testUpdate(): void
],
];

$result = $this->model->edit(3, $data);
$result = $this->model->edit(3, $data);
$this->assertEquals('testEdit', $result['pseudo']);
$this->assertEquals('Testing Tester', $result['person']['full_name']);
}
Expand Down

0 comments on commit 57993a9

Please sign in to comment.