Fix migration and test improvements

main
Igor Scheller 3 years ago
parent e361400f68
commit 80d87617f2

@ -17,11 +17,11 @@ class RemoveAdminNewsHtmlPrivilege extends Migration
$connection = $this->schema->getConnection();
// Delete unused privileges
$connection->delete('
DELETE FROM `Privileges`
WHERE `name` = \'admin_news_html\'
');
// Delete unused privilege
$connection->delete(
'DELETE FROM `Privileges` WHERE `name` = ?',
['admin_news_html']
);
}
/**
@ -33,9 +33,19 @@ class RemoveAdminNewsHtmlPrivilege extends Migration
return;
}
$connection->insert('
INSERT INTO `Privileges` (`name`, `desc`)
VALUES (\'admin_news_html\', \'Use HTML in news\')
');
$connection = $this->schema->getConnection();
$connection->insert(
'INSERT INTO `Privileges` (`name`, `desc`) VALUES (?, ?)',
['admin_news_html', 'Use HTML in news']
);
// Add permissions to news admins to edit html news
$connection->insert(
'
INSERT IGNORE INTO GroupPrivileges (group_id, privilege_id)
VALUES ((SELECT UID FROM `Groups` WHERE `name` = ?), (SELECT id FROM `Privileges` WHERE `name` = ?))
',
['News Admin', 'admin_news_html']
);
}
}

@ -31,6 +31,7 @@ class NewsControllerTest extends ControllerTest
/**
* @covers \Engelsystem\Controllers\Admin\NewsController::__construct
* @covers \Engelsystem\Controllers\Admin\NewsController::edit
* @covers \Engelsystem\Controllers\Admin\NewsController::showEdit
*/
public function testEdit()
{

@ -55,6 +55,7 @@ trait HasDatabase
['migration' => '2020_12_28_000000_oauth_set_identifier_binary'],
['migration' => '2021_08_26_000000_add_shirt_edit_permissions'],
['migration' => '2021_10_12_000000_add_shifts_description'],
['migration' => '2021_12_30_000000_remove_admin_news_html_privilege'],
]
);

Loading…
Cancel
Save