Skip to content

Commit

Permalink
Merge branch 'dev-5.1' into unitTest_MailAdminAppView_initalize
Browse files Browse the repository at this point in the history
  • Loading branch information
thangnn committed Apr 23, 2024
2 parents b3daa6f + d3db48f commit ae5db96
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions plugins/bc-blog/src/Model/Table/BlogPostsTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ public function beforeSave(EventInterface $event, EntityInterface $entity, Array
if (!Plugin::isLoaded('BcSearchIndex') || !$this->searchIndexSaving) {
return;
}
$this->unsetExcluded();
// 検索用テーブルに登録
if ($entity->exclude_search
|| empty($entity->blog_content->content)
Expand Down
7 changes: 7 additions & 0 deletions plugins/bc-blog/tests/Scenario/MultiSiteBlogPostScenario.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,14 @@ protected function createBlogPosts()
{
BlogPostFactory::make([
'id' => 1,
'user_id' => 1,
'blog_content_id' => 6,
'blog_category_id' => 6,
'no' => 3,
'name' => 'release',
'title' => 'プレスリリース',
'status' => 1,
'exclude_search' => 0,
'posted' => '2015-01-27 12:57:59',
])->persist();
BlogPostFactory::make([
Expand All @@ -131,6 +133,7 @@ protected function createBlogPosts()
'name' => 'smartphone_release',
'title' => 'スマホサイトリリース',
'status' => 1,
'exclude_search' => 0,
'posted' => '2016-02-10 12:57:59',
])->persist();
BlogPostFactory::make([
Expand All @@ -140,6 +143,7 @@ protected function createBlogPosts()
'name' => 'english_release',
'title' => '英語サイトリリース',
'status' => 1,
'exclude_search' => 0,
])->persist();
BlogPostFactory::make([
'id' => 4,
Expand All @@ -148,6 +152,7 @@ protected function createBlogPosts()
'name' => 'another_domain_release',
'title' => '別サイトリリース',
'status' => 1,
'exclude_search' => 0,
])->persist();
BlogPostFactory::make([
'id' => 5,
Expand All @@ -156,6 +161,7 @@ protected function createBlogPosts()
'name' => 'sub_domain_release',
'title' => '別サイトリリース',
'status' => 1,
'exclude_search' => 0,
])->persist();
BlogPostFactory::make([
'id' => 6,
Expand All @@ -164,6 +170,7 @@ protected function createBlogPosts()
'name' => 'release',
'title' => 'プレスリリース',
'status' => 1,
'exclude_search' => 0,
])->persist();
return null;
}
Expand Down
3 changes: 1 addition & 2 deletions plugins/bc-blog/tests/TestCase/Model/BlogPostsTableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@
use BcBlog\Test\Factory\BlogCategoryFactory;
use BcBlog\Test\Factory\BlogContentFactory;
use BcBlog\Test\Factory\BlogPostFactory;
use BcBlog\Test\Scenario\BlogPostsScenario;
use BcBlog\Test\Scenario\MultiSiteBlogPostScenario;
use Cake\Event\Event;
use Cake\I18n\FrozenTime;
use CakephpFixtureFactories\Scenario\ScenarioAwareTrait;
use ArrayObject;
/**
Expand Down Expand Up @@ -770,6 +768,7 @@ public function test_beforeSave()
$this->loadFixtureScenario(MultiSiteBlogPostScenario::class);

$blogPost = $BlogPostsService->get(1);
$blogPost->exclude_search = 1;
$this->BlogPostsTable->beforeSave(new Event("beforeSave"), $blogPost, new ArrayObject());
$this->assertTrue($this->BlogPostsTable->isExcluded());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ public function test_getViewVarsForBlogAuthorArchivesWidget()
// データを生成
$this->loadFixtureScenario(MultiSiteBlogPostScenario::class);
UserFactory::make([
'id' => BlogPostFactory::get(1)->user_id,
'id' => 1,
'name' => 'name_test',
'real_name_1' => 'real_name_1_test',
'real_name_2' => 'real_name_2_test',
Expand Down

0 comments on commit ae5db96

Please sign in to comment.