Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mrothauer committed Nov 30, 2023
1 parent 49d66bb commit fc410b4
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 33 deletions.
4 changes: 1 addition & 3 deletions config/sql/info-sheets-download.sql
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ SELECT
DATE_FORMAT(i.created, '%Y') - i.device_age as "Baujahr",
DATE_FORMAT(e.datumstart, '%d.%m.%Y') as "Datum Reparaturveranstaltung",
defect_description as Fehlerbeschreibung,
defect_found_ffo2.name as "Fehler gefunden?",
defect_found_ffo3.name as Reparaturerfolg,
defect_found_ffo4.name as "Reparatur: vertagt",
defect_found_ffo5.name as "Reparatur: nicht erfolgt",
Expand All @@ -20,12 +19,11 @@ LEFT JOIN categories c ON c.id = i.category_id
LEFT JOIN categories pc ON pc.id = c.parent_id
JOIN events e ON e.uid = i.event_uid
JOIN workshops w ON e.workshop_uid = w.uid
LEFT JOIN form_field_options defect_found_ffo2 ON defect_found_ffo2.form_field_id = 2 AND defect_found_ffo2.value = i.defect_found
LEFT JOIN form_field_options defect_found_ffo3 ON defect_found_ffo3.form_field_id = 3 AND defect_found_ffo3.value = i.defect_found_reason
LEFT JOIN form_field_options defect_found_ffo4 ON defect_found_ffo4.form_field_id = 4 AND defect_found_ffo4.value = i.repair_postponed_reason
LEFT JOIN form_field_options defect_found_ffo5 ON defect_found_ffo5.form_field_id = 5 AND defect_found_ffo5.value = i.no_repair_reason
LEFT JOIN form_field_options defect_found_ffo6 ON defect_found_ffo6.form_field_id = 6 AND defect_found_ffo6.value = i.device_must_not_be_used_anymore
WHERE 1
AND i.status = 1
AND w.uid = :workshopUid
ORDER by e.datumstart DESC
ORDER by e.datumstart DESC, i.uid DESC
5 changes: 0 additions & 5 deletions config/sql/info-sheets-full-download.sql
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ SELECT
DATE_FORMAT(i.created, '%Y') - i.device_age as "year_of_manufacture",
TRIM(
CONCAT(
COALESCE(ffoeiA.repair_status, ''), ' ',
COALESCE(ffoeiB.repair_status, ''), ' ',
COALESCE(ffoeiC.repair_status, ''), ' ',
COALESCE(ffoeiD.repair_status, ''), ' ',
Expand All @@ -21,14 +20,12 @@ SELECT
) as "repair_status",
TRIM(
CONCAT(
COALESCE(ffoeiA.repair_barrier_if_end_of_life, ''), ' ',
COALESCE(ffoeiB.repair_barrier_if_end_of_life, ''), ' ',
COALESCE(ffoeiC.repair_barrier_if_end_of_life, ''), ' ',
COALESCE(ffoeiD.repair_barrier_if_end_of_life, ''), ' ',
COALESCE(ffoeiE.repair_barrier_if_end_of_life, '')
)
) as "repair_barrier_if_end_of_life",
defect_found_ffo2.name as "defect_found_name",
defect_found_ffo3.name as "defect_found_reason",
defect_found_ffo4.name as "repair_postponed_reason",
defect_found_ffo5.name as "no_repair_reason",
Expand All @@ -48,12 +45,10 @@ LEFT JOIN ords_categories oc ON c.ords_category_id = oc.id
JOIN events e ON e.uid = i.event_uid
JOIN workshops w ON e.workshop_uid = w.uid
LEFT JOIN countries country ON w.country_code = country.code
LEFT JOIN form_field_options defect_found_ffo2 ON defect_found_ffo2.form_field_id = 2 AND defect_found_ffo2.value = i.defect_found
LEFT JOIN form_field_options defect_found_ffo3 ON defect_found_ffo3.form_field_id = 3 AND defect_found_ffo3.value = i.defect_found_reason
LEFT JOIN form_field_options defect_found_ffo4 ON defect_found_ffo4.form_field_id = 4 AND defect_found_ffo4.value = i.repair_postponed_reason
LEFT JOIN form_field_options defect_found_ffo5 ON defect_found_ffo5.form_field_id = 5 AND defect_found_ffo5.value = i.no_repair_reason
LEFT JOIN form_field_options defect_found_ffo6 ON defect_found_ffo6.form_field_id = 6 AND defect_found_ffo6.value = i.device_must_not_be_used_anymore
LEFT JOIN form_field_options_extra_infos ffoeiA ON ffoeiA.form_field_options_id = defect_found_ffo2.id
LEFT JOIN form_field_options_extra_infos ffoeiB ON ffoeiB.form_field_options_id = defect_found_ffo3.id
LEFT JOIN form_field_options_extra_infos ffoeiC ON ffoeiC.form_field_options_id = defect_found_ffo4.id
LEFT JOIN form_field_options_extra_infos ffoeiD ON ffoeiD.form_field_options_id = defect_found_ffo5.id
Expand Down
14 changes: 0 additions & 14 deletions tests/Fixture/FormFieldOptionsFixture.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,6 @@ public function init(): void
'name' => '',
'status' => 1,
],
[
'id' => 6,
'form_field_id' => 2,
'value' => 1,
'name' => '',
'status' => 1,
],
[
'id' => 7,
'form_field_id' => 2,
'value' => 0,
'name' => '',
'status' => 1,
],
[
'id' => 8,
'form_field_id' => 4,
Expand Down
6 changes: 0 additions & 6 deletions tests/Fixture/FormFieldsFixture.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@ public function init(): void
'identifier' => 'power_supply',
'status' => 1,
],
[
'id' => 2,
'name' => 'Fehler gefunden?',
'identifier' => 'defect_found',
'status' => 1,
],
[
'id' => 3,
'name' => 'Reparatur',
Expand Down
3 changes: 0 additions & 3 deletions tests/TestCase/Controller/InfoSheetsControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ class InfoSheetsControllerTest extends AppTestCase
]
],
'defect_description' => '',
'defect_found' => '',
'defect_found_reason' => 2,
'repair_postponed_reason' => 3,
'no_repair_reason' => '',
Expand All @@ -54,7 +53,6 @@ public function testAddInfoSheetValidations()
);
$this->assertResponseContains('Bitte gib die Fehlerbeschreibung an (maximal 1.000 Zeichen).');
$this->assertResponseContains('Bitte wähle eine Kategorie aus.');
$this->assertResponseContains('Wurde der Fehler gefunden?');
}

public function testAddInfoSheetOk()
Expand All @@ -63,7 +61,6 @@ public function testAddInfoSheetOk()
$this->newInfoSheetData['defect_description'] = 'Defect description';
$this->newInfoSheetData['device_name'] = 'Device name';
$this->newInfoSheetData['category_id'] = 87;
$this->newInfoSheetData['defect_found'] = 1;
$this->newInfoSheetData['device_age'] = 1;
$this->post(
Configure::read('AppConfig.htmlHelper')->urlInfoSheetNew(6),
Expand Down
4 changes: 2 additions & 2 deletions tests/comparisons/info-sheets-download.csv
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Laufzettel-UID,Oberkategorie,Unterkategorie,Marke,Gerät/Gegenstand,Baujahr,"Datum Reparaturveranstaltung",Fehlerbeschreibung,"Fehler gefunden?",Reparaturerfolg,"Reparatur: vertagt","Reparatur: nicht erfolgt","Reparatur: Abbruch","Keine Reparatur, weil",Url
7,,,,,,01.01.2040,,,,,,,,"https://www.reparatur-initiativen.de/test-workshop?event=6,2040-01-01"
Laufzettel-UID,Oberkategorie,Unterkategorie,Marke,Gerät/Gegenstand,Baujahr,"Datum Reparaturveranstaltung",Fehlerbeschreibung,Reparaturerfolg,"Reparatur: vertagt","Reparatur: nicht erfolgt","Reparatur: Abbruch","Keine Reparatur, weil",Url
7,,,,,,01.01.2040,,,,,,,"https://www.reparatur-initiativen.de/test-workshop?event=6,2040-01-01"

0 comments on commit fc410b4

Please sign in to comment.