Skip to content

Commit

Permalink
アクセスルールグループ編集画面で、urlのフィールドが提供されていない場合のテストを追加
Browse files Browse the repository at this point in the history
  • Loading branch information
ryuring committed Feb 27, 2024
1 parent ca955f1 commit bf0dd9a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
5 changes: 3 additions & 2 deletions plugins/baser-core/src/Model/Table/PermissionsTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,9 @@ public function validationPlain($validator)
public function beforeSave(EventInterface $event, EntityInterface $entity, ArrayObject $options)
{
$data = $event->getData();
if (preg_match('/^[^\/]/is', $data["entity"]->get("url"))) {
$data["entity"]->set("url", '/' . $data["entity"]->get("url"));
$url = $data["entity"]->get("url");
if ($url && preg_match('/^[^\/]/is', $url)) {
$data["entity"]->set("url", '/' . $url);
}
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public function load(...$args)
])->persist();

PermissionFactory::make([
'id' => 1,
'no' => 1,
'sort' => 1,
'name' => 'システム管理',
Expand All @@ -67,6 +68,7 @@ public function load(...$args)
])->persist();

PermissionFactory::make([
'id' => 2,
'no' => 1,
'sort' => 1,
'name' => 'よく使う項目',
Expand All @@ -81,6 +83,7 @@ public function load(...$args)
])->persist();

PermissionFactory::make([
'id' => 3,
'no' => 1,
'sort' => 1,
'name' => 'ページ管理',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,14 @@ public function test_edit()
$this->loadFixtureScenario(PermissionGroupsScenario::class);
$data = [
'name' => 'システム基本設定 Update',
'permissions' => [[
'id' => "1",
'name' => "一覧",
'user_group_id' => "2",
'method' => "GET",
'auth' => "1",
'status' => "1"
]]
];
$this->post('/baser/admin/baser-core/permission_groups/edit/1/1', $data);
//メッセージを確認
Expand Down

0 comments on commit bf0dd9a

Please sign in to comment.