|
12 | 12 | namespace BcBlog\Test\TestCase\View\Helper; |
13 | 13 |
|
14 | 14 | use BaserCore\Test\Factory\ContentFactory; |
15 | | -use BaserCore\Test\Factory\SiteConfigFactory; |
| 15 | +use BaserCore\Test\Factory\PluginFactory; |
16 | 16 | use BaserCore\Test\Factory\SiteFactory; |
17 | 17 | use BaserCore\Test\Scenario\InitAppScenario; |
18 | 18 | use BaserCore\Test\Scenario\RootContentScenario; |
@@ -67,6 +67,7 @@ public function setUp(): void |
67 | 67 | '/news/', // url |
68 | 68 | 'test title' |
69 | 69 | ); |
| 70 | + PluginFactory::make(['id' => 'BcBlog', 'name' => 'BcBlog', 'status' => true])->persist(); |
70 | 71 | $view = new BlogFrontAppView($this->getRequest()); |
71 | 72 | $blogContent = BlogContentFactory::get(1); |
72 | 73 | $blogContent->content = ContentFactory::get(1); |
@@ -1322,6 +1323,7 @@ public function testPosts($currentUrl, $contentsName, $num, $options, $expected, |
1322 | 1323 | BlogPostFactory::make(['blog_content_id' => 1, 'blog_category_id' => 1, 'posted' => '2017-03-27 12:57:59'])->persist(); |
1323 | 1324 | BlogTagFactory::make(['id' => 1, 'name' => '新製品'])->persist(); |
1324 | 1325 | BlogPostBlogTagFactory::make(['blog_post_id' => 1, 'blog_tag_id' => 1])->persist(); |
| 1326 | + SiteFactory::make(['id' => 1])->persist(); |
1325 | 1327 |
|
1326 | 1328 | $this->expectOutputRegex($expected); |
1327 | 1329 |
|
@@ -1367,6 +1369,33 @@ public static function postsDataProvider() |
1367 | 1369 | ]; |
1368 | 1370 | } |
1369 | 1371 |
|
| 1372 | + /** |
| 1373 | + * test posts with return |
| 1374 | + * @return void |
| 1375 | + */ |
| 1376 | + public function testPostsWithReturn() |
| 1377 | + { |
| 1378 | + $this->truncateTable('contents'); |
| 1379 | + $this->truncateTable('blog_contents'); |
| 1380 | + $this->truncateTable('blog_posts'); |
| 1381 | + |
| 1382 | + // データ生成 |
| 1383 | + $this->loadFixtureScenario( |
| 1384 | + BlogContentScenario::class, |
| 1385 | + 1, // id |
| 1386 | + 1, // siteId |
| 1387 | + 1, // parentId |
| 1388 | + 'news', // name |
| 1389 | + '/news/', // url, |
| 1390 | + 'News 1' // title |
| 1391 | + ); |
| 1392 | + SiteFactory::make(['id' => 1])->persist(); |
| 1393 | + BlogPostFactory::make(['id' => 1, 'blog_content_id' => 1, 'title' => 'title test'])->persist(); |
| 1394 | + |
| 1395 | + $result = $this->Blog->posts('/news/', 5, ['return' => true]); |
| 1396 | + $this->assertTextContains('title test', $result); |
| 1397 | + } |
| 1398 | + |
1370 | 1399 | /** |
1371 | 1400 | * ブログ記事を取得する |
1372 | 1401 | */ |
|
0 commit comments