Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Admin_EditorTemplatesController_add #3338

Merged
merged 11 commits into from
May 24, 2024
Merged

add Admin_EditorTemplatesController_add #3338

merged 11 commits into from
May 24, 2024

Conversation

thangnnmd
Copy link
Collaborator

add Admin_EditorTemplatesController_add

@HungDV2022
Copy link
Collaborator

@ryuring レビューをお願いします。

@HungDV2022 HungDV2022 assigned ryuring and unassigned HungDV2022 Apr 15, 2024
@ryuring
Copy link
Collaborator

ryuring commented Apr 16, 2024

@thangnnmd @HungDV2022 ありがとうございます。こちら問題ないですが、あと、afterAdd と beforeAdd のイベントが呼び出されるかのテストをお願いしたいです。 BcTestCase::entryEventToMock を利用してください。
テストメソッドを分けても構いません。

plugins/bc-blog/tests/TestCase/Controller/Admin/BlogTagsControllerTest.phptestBeforeAddEvent が参考になると思います。

@ryuring ryuring assigned HungDV2022 and thangnnmd and unassigned ryuring Apr 16, 2024
@ryuring ryuring added the Reviewed レビュー済 label Apr 16, 2024
@thangnnmd thangnnmd removed their assignment Apr 17, 2024
@HungDV2022
Copy link
Collaborator

@thangnnmd @HungDV2022 ありがとうございます。こちら問題ないですが、あと、afterAdd と beforeAdd のイベントが呼び出されるかのテストをお願いしたいです。 BcTestCase::entryEventToMock を利用してください。 テストメソッドを分けても構いません。

plugins/bc-blog/tests/TestCase/Controller/Admin/BlogTagsControllerTest.phptestBeforeAddEvent が参考になると思います。

@ryuring afterAdd と beforeAdd のイベントは別PRを調整しました。確認お願いします

@HungDV2022 HungDV2022 assigned ryuring and unassigned HungDV2022 Apr 17, 2024
@momofff momofff added this to the 5.1.0 milestone Apr 18, 2024
@thangnnmd thangnnmd assigned thangnnmd and unassigned ryuring Apr 19, 2024
@thangnnmd
Copy link
Collaborator Author

@HungDV2022
Screen Shot 2024-04-19 at 10 15 37
khi case error

@thangnnmd thangnnmd assigned HungDV2022 and unassigned thangnnmd Apr 23, 2024
@HungDV2022
Copy link
Collaborator

@HungDV2022 Screen Shot 2024-04-19 at 10 15 37 khi case error

@thangnnmd lỗi này là do a thiếu data trong db a nhé.
SiteConfigFactory::make(['name' => 'editor', 'value' => 'BaserCore.BcCkeditor'])->persist();

//check message error
       $this->post('/baser/admin/bc-editor-template/editor_templates/add', ['name' => '']);
       $this->assertResponseCode(200);
       //エラーメッセージを確認
       $vars = $this->_controller->viewBuilder()->getVars();
       $this->assertEquals(['name' => ['_empty' => "テンプレート名を入力してください。"]], $vars['editorTemplate']->getErrors());


@HungDV2022 HungDV2022 assigned thangnnmd and unassigned HungDV2022 May 8, 2024
@thangnnmd thangnnmd assigned HungDV2022 and unassigned thangnnmd May 8, 2024
@HungDV2022
Copy link
Collaborator

@ryuring レビューをお願いします

@HungDV2022 HungDV2022 assigned ryuring and unassigned HungDV2022 May 9, 2024
$this->enableSecurityToken();
$this->enableCsrfToken();

SiteConfigFactory::make(['name' => 'editor', 'value' => 'BaserCore.BcCkeditor'])->persist();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@HungDV2022 @thangnnmd この行は無くてもテストは動きませんか?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ryuring
#3338 (comment)
この行はなし場合は画像のようにエラーを発生しました。
確認お願いします。

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@HungDV2022 そのエラーが出る方が問題のような気がしますね。一度調べてみます。

Copy link
Collaborator

@ryuring ryuring May 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@HungDV2022 @thangnnmd 調べました。本体に問題がありました。
plugins/bc-editor-template/src/Controller/Admin/EditorTemplatesController.php を次のように修正してください。

76行目、119行目に return を追加

return $this->redirect(['action' => 'index']);

87行目、130行目を削除(なくてもブラウザで正常に動作しました)

$this->viewBuilder()->addHelper(BcSiteConfig::get('editor'));

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

そうすると SiteConfigFactory は不要になります。

@ryuring ryuring assigned HungDV2022 and thangnnmd and unassigned ryuring May 17, 2024
@HungDV2022 HungDV2022 assigned ryuring and unassigned HungDV2022 and thangnnmd May 17, 2024
@ryuring ryuring assigned HungDV2022 and thangnnmd and unassigned ryuring May 17, 2024
@HungDV2022 HungDV2022 removed their assignment May 17, 2024
@thangnnmd thangnnmd assigned HungDV2022 and unassigned thangnnmd May 20, 2024
@HungDV2022
Copy link
Collaborator

@ryuring 確認お願いします。

@HungDV2022 HungDV2022 assigned ryuring and unassigned HungDV2022 May 22, 2024
@ryuring
Copy link
Collaborator

ryuring commented May 24, 2024

ありがとうございます、マージします!

@ryuring ryuring merged commit b81ee6f into baserproject:dev-5.1 May 24, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Reviewed レビュー済
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants