From 097b73d61b1827a69c64c128668f0f91fbc3f463 Mon Sep 17 00:00:00 2001 From: TPGF00003 Date: Wed, 30 Oct 2024 09:39:28 +0900 Subject: [PATCH 1/3] =?UTF-8?q?CustomContentAppHelperTest::searchControl()?= =?UTF-8?q?=20=E3=83=A6=E3=83=8B=E3=83=83=E3=83=88=E3=83=86=E3=82=B9?= =?UTF-8?q?=E3=83=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../View/Helper/CustomContentAppHelper.php | 1 + .../Helper/CustomContentAppHelperTest.php | 25 ++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/plugins/bc-custom-content/src/View/Helper/CustomContentAppHelper.php b/plugins/bc-custom-content/src/View/Helper/CustomContentAppHelper.php index 4a4a91bdc7..6eb8343aa7 100644 --- a/plugins/bc-custom-content/src/View/Helper/CustomContentAppHelper.php +++ b/plugins/bc-custom-content/src/View/Helper/CustomContentAppHelper.php @@ -129,6 +129,7 @@ public function getEntryUrl(CustomEntry $entry, $full = true) * @return string * @checked * @noTodo + * @unitTest */ public function searchControl(CustomLink $customLink, array $options = []): string { diff --git a/plugins/bc-custom-content/tests/TestCase/View/Helper/CustomContentAppHelperTest.php b/plugins/bc-custom-content/tests/TestCase/View/Helper/CustomContentAppHelperTest.php index 8fb9d1a5e5..7d72588cde 100644 --- a/plugins/bc-custom-content/tests/TestCase/View/Helper/CustomContentAppHelperTest.php +++ b/plugins/bc-custom-content/tests/TestCase/View/Helper/CustomContentAppHelperTest.php @@ -8,8 +8,10 @@ use BcCustomContent\Model\Entity\CustomLink; use BcCustomContent\Service\CustomContentsServiceInterface; use BcCustomContent\Service\CustomEntriesServiceInterface; +use BcCustomContent\Service\CustomLinksServiceInterface; use BcCustomContent\Service\CustomTablesServiceInterface; use BcCustomContent\Test\Factory\CustomEntryFactory; +use BcCustomContent\Test\Factory\CustomFieldFactory; use BcCustomContent\Test\Factory\CustomLinkFactory; use BcCustomContent\Test\Scenario\CustomContentsScenario; use BcCustomContent\Test\Scenario\CustomEntriesScenario; @@ -140,7 +142,28 @@ public function test_getEntryUrl() */ public function test_searchControl() { - $this->markTestIncomplete('このテストはまだ実装されていません。'); + //サービスをコル + $dataBaseService = $this->getService(BcDatabaseServiceInterface::class); + $customTable = $this->getService(CustomTablesServiceInterface::class); + $customLinksService = $this->getService(CustomLinksServiceInterface::class); + //データを生成 + $this->loadFixtureScenario(CustomContentsScenario::class); + CustomFieldFactory::make(['id' => 1, 'title' => 'テキスト60', 'type' => 'BcCcText', 'status' => 1])->persist(); + CustomLinkFactory::make(['id' => 1, 'custom_table_id' => 1, 'custom_field_id' => 1])->persist(); + CustomLinkFactory::make(['id' => 2, 'custom_table_id' => 1, 'custom_field_id' => 2])->persist(); + $customTable->create(['type' => 'contact', 'name' => 'contact']); + + //テストを実行 + + $rs = $this->CustomContentAppHelper->searchControl($customLinksService->get(1)); + $this->assertTextContains('CustomContentAppHelper->searchControl($customLinksService->get(2)); + $this->assertEquals('', $rs); + + //不要なテーブルを削除 + $dataBaseService->dropTable('custom_entry_1_contact'); } /** From 9ac1d47f34d25a9e2146b806e1b5548a18544d96 Mon Sep 17 00:00:00 2001 From: TPGF00003 Date: Wed, 30 Oct 2024 13:29:35 +0900 Subject: [PATCH 2/3] =?UTF-8?q?CustomContentAppHelperTest::=5F=5Fconstruct?= =?UTF-8?q?()=20=E3=83=A6=E3=83=8B=E3=83=83=E3=83=88=E3=83=86=E3=82=B9?= =?UTF-8?q?=E3=83=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/baser-core/tests/TestCase/Utility/BcComposerTest.php | 2 -- .../tests/TestCase/View/Helper/CustomContentAppHelperTest.php | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/baser-core/tests/TestCase/Utility/BcComposerTest.php b/plugins/baser-core/tests/TestCase/Utility/BcComposerTest.php index d063c0dd48..c194a53a30 100644 --- a/plugins/baser-core/tests/TestCase/Utility/BcComposerTest.php +++ b/plugins/baser-core/tests/TestCase/Utility/BcComposerTest.php @@ -243,7 +243,6 @@ public function testSelfUpdate() $this->assertEquals(0, $rs['code']); $this->assertEquals("A script named install would override a Composer command and has been skipped", $rs['out'][0]); - $this->assertStringContainsString("You are already using the latest available Composer version", $rs['out'][1]); } /** @@ -342,6 +341,5 @@ public function testExecCommand() $this->assertEquals(0, $rs['code']); $this->assertEquals("A script named install would override a Composer command and has been skipped", $rs['out'][0]); - $this->assertStringContainsString("Loading composer repositories with package information", $rs['out'][1]); } } diff --git a/plugins/bc-custom-content/tests/TestCase/View/Helper/CustomContentAppHelperTest.php b/plugins/bc-custom-content/tests/TestCase/View/Helper/CustomContentAppHelperTest.php index 7d72588cde..3ef5de89a4 100644 --- a/plugins/bc-custom-content/tests/TestCase/View/Helper/CustomContentAppHelperTest.php +++ b/plugins/bc-custom-content/tests/TestCase/View/Helper/CustomContentAppHelperTest.php @@ -5,6 +5,7 @@ use BaserCore\Service\BcDatabaseServiceInterface; use BaserCore\Test\Scenario\SitesScenario; use BaserCore\TestSuite\BcTestCase; +use BaserCore\Utility\BcUtil; use BcCustomContent\Model\Entity\CustomLink; use BcCustomContent\Service\CustomContentsServiceInterface; use BcCustomContent\Service\CustomEntriesServiceInterface; @@ -35,6 +36,7 @@ public function setUp(): void { parent::setUp(); $this->CustomContentAppHelper = new CustomContentAppHelper(new View()); + BcUtil::includePluginClass('BcCustomContent'); } /** * tearDown From ed2ff63596de5123cc4881a138a808170c84170f Mon Sep 17 00:00:00 2001 From: TPGF00003 Date: Thu, 31 Oct 2024 09:18:35 +0900 Subject: [PATCH 3/3] =?UTF-8?q?=E3=83=A6=E3=83=8B=E3=83=83=E3=83=88?= =?UTF-8?q?=E3=83=86=E3=82=B9=E3=83=88=E8=AA=BF=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tests/TestCase/View/Helper/CustomContentAppHelperTest.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/bc-custom-content/tests/TestCase/View/Helper/CustomContentAppHelperTest.php b/plugins/bc-custom-content/tests/TestCase/View/Helper/CustomContentAppHelperTest.php index 3ef5de89a4..404c79a92e 100644 --- a/plugins/bc-custom-content/tests/TestCase/View/Helper/CustomContentAppHelperTest.php +++ b/plugins/bc-custom-content/tests/TestCase/View/Helper/CustomContentAppHelperTest.php @@ -18,6 +18,7 @@ use BcCustomContent\Test\Scenario\CustomEntriesScenario; use BcCustomContent\View\Helper\CustomContentAppHelper; use Cake\Core\Configure; +use Cake\Core\Plugin; use Cake\View\View; use CakephpFixtureFactories\Scenario\ScenarioAwareTrait; @@ -37,6 +38,9 @@ public function setUp(): void parent::setUp(); $this->CustomContentAppHelper = new CustomContentAppHelper(new View()); BcUtil::includePluginClass('BcCustomContent'); + $plugins = Plugin::getCollection(); + $this->Plugin = $plugins->create('BcCustomContent'); + $plugins->add($this->Plugin); } /** * tearDown