diff --git a/plugins/bc-admin-third/src/bc_theme_file/js/admin/theme_files/submenus.js b/plugins/bc-admin-third/src/bc_theme_file/js/admin/theme_files/submenus.js
index bf115f5142..a455d4f26f 100644
--- a/plugins/bc-admin-third/src/bc_theme_file/js/admin/theme_files/submenus.js
+++ b/plugins/bc-admin-third/src/bc_theme_file/js/admin/theme_files/submenus.js
@@ -8,10 +8,11 @@
* @license https://basercms.net/license/index.html MIT License
*/
-$(function (){
+$(function () {
$('#ThemeFilesMenu').accordion({
collapsible: true,
- heightStyle: "content"
+ heightStyle: "content",
+ active: parseInt($('.selected-plugin').attr("data-id"))
});
});
diff --git a/plugins/bc-admin-third/templates/plugin/BcThemeFile/Admin/element/ThemeFiles/submenus.php b/plugins/bc-admin-third/templates/plugin/BcThemeFile/Admin/element/ThemeFiles/submenus.php
index d4fa26c896..d2585d8dbb 100755
--- a/plugins/bc-admin-third/templates/plugin/BcThemeFile/Admin/element/ThemeFiles/submenus.php
+++ b/plugins/bc-admin-third/templates/plugin/BcThemeFile/Admin/element/ThemeFiles/submenus.php
@@ -15,6 +15,7 @@
* @var \BaserCore\View\BcAdminAppView $this
* @var bool $isDefaultTheme
* @var string $theme
+ * @var string $plugin
*/
$types = [
'layout' => __d('baser_core', 'レイアウト'),
@@ -38,17 +39,25 @@
-
-
-
-
+ $pluginVal): ?>
+
+
+
+
+
$type): ?>
-
-
- BcBaser->link(sprintf(__d('baser_core', '%s 一覧'), $type), ['action' => 'index', $theme, $plugin['name'], $key]) ?>
+
+ BcBaser->link(sprintf(__d('baser_core', '%s 一覧'), $type), ['action' => 'index', $theme, $pluginVal['name'], $key]) ?>
BcBaser->link(sprintf(__d('baser_core', '%s 一覧'), $type), ['action' => 'index', $theme, $key]) ?>
diff --git a/plugins/bc-admin-third/webroot/bc_theme_file/js/admin/theme_files/submenus.bundle.js b/plugins/bc-admin-third/webroot/bc_theme_file/js/admin/theme_files/submenus.bundle.js
index 7fb53ee251..25c26005c4 100644
--- a/plugins/bc-admin-third/webroot/bc_theme_file/js/admin/theme_files/submenus.bundle.js
+++ b/plugins/bc-admin-third/webroot/bc_theme_file/js/admin/theme_files/submenus.bundle.js
@@ -7,5 +7,5 @@
* @since 5.0.0
* @license https://basercms.net/license/index.html MIT License
*/
-$((function(){$("#ThemeFilesMenu").accordion({collapsible:!0,heightStyle:"content"})}));
-//# sourceMappingURL=submenus.bundle.js.map
\ No newline at end of file
+$((function(){$("#ThemeFilesMenu").accordion({collapsible:!0,heightStyle:"content",active:parseInt($('.selected-plugin').attr("data-id"))})}));
+//# sourceMappingURL=submenus.bundle.js.map
diff --git a/plugins/bc-custom-content/src/Model/Table/CustomEntriesTable.php b/plugins/bc-custom-content/src/Model/Table/CustomEntriesTable.php
index 4974794c7c..f7114da921 100644
--- a/plugins/bc-custom-content/src/Model/Table/CustomEntriesTable.php
+++ b/plugins/bc-custom-content/src/Model/Table/CustomEntriesTable.php
@@ -168,6 +168,7 @@ public function setUp(int $tableId, array $postData = [])
* @param int $tableId
* @checked
* @noTodo
+ * @unitTest
*/
public function setUseTable(int $tableId)
{
@@ -179,6 +180,9 @@ public function setUseTable(int $tableId)
*
* @param int $tableId
* @return string
+ * @noTodo
+ * @checked
+ * @unitTest
*/
public function getTableName(int $tableId, string $name = ''): string
{
diff --git a/plugins/bc-custom-content/src/Model/Table/CustomLinksTable.php b/plugins/bc-custom-content/src/Model/Table/CustomLinksTable.php
index fc6c10eb0f..bf2511c626 100644
--- a/plugins/bc-custom-content/src/Model/Table/CustomLinksTable.php
+++ b/plugins/bc-custom-content/src/Model/Table/CustomLinksTable.php
@@ -113,6 +113,9 @@ public function implementedEvents(): array
* ツリービヘイビアのスコープを設定する
*
* @param int $tableId
+ * @noTodo
+ * @checked
+ * @unitTest
*/
public function setTreeScope(int $tableId): void
{
diff --git a/plugins/bc-custom-content/tests/TestCase/Model/Table/CustomEntriesTableTest.php b/plugins/bc-custom-content/tests/TestCase/Model/Table/CustomEntriesTableTest.php
index 3a79055da0..7cb3d20fc2 100644
--- a/plugins/bc-custom-content/tests/TestCase/Model/Table/CustomEntriesTableTest.php
+++ b/plugins/bc-custom-content/tests/TestCase/Model/Table/CustomEntriesTableTest.php
@@ -296,12 +296,20 @@ public function test_setUp()
public function test_setUseTable()
{
//準備
-
- //正常系実行
-
- //異常系実行
-
-
+ $dataBaseService = $this->getService(BcDatabaseServiceInterface::class);
+ $customTable = $this->getService(CustomTablesServiceInterface::class);
+ $customTable->create([
+ 'id' => 1,
+ 'name' => 'recruit',
+ 'title' => '求人情報',
+ 'type' => '1',
+ 'display_field' => 'title',
+ ]);
+ $this->CustomEntriesTable->setUseTable(1);
+ $result = $this->CustomEntriesTable->getTable();
+ $this->assertEquals('custom_entry_1_recruit', $result);
+ //不要なテーブルを削除
+ $dataBaseService->dropTable('custom_entry_1_recruit');
}
/**
@@ -310,11 +318,23 @@ public function test_setUseTable()
public function test_getTableName()
{
//準備
-
- //正常系実行
-
- //異常系実行
-
+ $dataBaseService = $this->getService(BcDatabaseServiceInterface::class);
+ $customTable = $this->getService(CustomTablesServiceInterface::class);
+ $customTable->create([
+ 'id' => 1,
+ 'name' => 'recruit',
+ 'title' => '求人情報',
+ 'type' => '1',
+ 'display_field' => 'title',
+ ]);
+ //正常系実行: name パラメータなし
+ $result = $this->CustomEntriesTable->getTableName(1);
+ $this->assertEquals('custom_entry_1_recruit', $result);
+ //正常系実行: name パラメータあり
+ $result = $this->CustomEntriesTable->getTableName(1, 'Nghiem');
+ $this->assertEquals('custom_entry_1_Nghiem', $result);
+ //不要なテーブルを削除
+ $dataBaseService->dropTable('custom_entry_1_recruit');
}
diff --git a/plugins/bc-custom-content/tests/TestCase/Model/Table/CustomLinksTableTest.php b/plugins/bc-custom-content/tests/TestCase/Model/Table/CustomLinksTableTest.php
index ab01525ecb..634e48498b 100644
--- a/plugins/bc-custom-content/tests/TestCase/Model/Table/CustomLinksTableTest.php
+++ b/plugins/bc-custom-content/tests/TestCase/Model/Table/CustomLinksTableTest.php
@@ -106,7 +106,9 @@ public function test_implementedEvents()
*/
public function test_setTreeScope()
{
-
+ $this->CustomLinksTable->setTreeScope(1);
+ $result = $this->CustomLinksTable->getBehavior('Tree')->getConfig('scope');
+ $this->assertEquals(['custom_table_id' => 1], $result);
}
/**
diff --git a/plugins/bc-theme-config/src/ServiceProvider/BcThemeConfigServiceProvider.php b/plugins/bc-theme-config/src/ServiceProvider/BcThemeConfigServiceProvider.php
index 46e0032858..fdc6813445 100755
--- a/plugins/bc-theme-config/src/ServiceProvider/BcThemeConfigServiceProvider.php
+++ b/plugins/bc-theme-config/src/ServiceProvider/BcThemeConfigServiceProvider.php
@@ -39,6 +39,7 @@ class BcThemeConfigServiceProvider extends ServiceProvider
* @param \Cake\Core\ContainerInterface $container
* @checked
* @noTodo
+ * @unitTest
*/
public function services($container): void
{
diff --git a/plugins/bc-theme-config/tests/TestCase/ServiceProvider/BcThemeConfigServiceProviderTest.php b/plugins/bc-theme-config/tests/TestCase/ServiceProvider/BcThemeConfigServiceProviderTest.php
new file mode 100755
index 0000000000..0a653319bd
--- /dev/null
+++ b/plugins/bc-theme-config/tests/TestCase/ServiceProvider/BcThemeConfigServiceProviderTest.php
@@ -0,0 +1,58 @@
+
+ * Copyright (c) NPO baser foundation
+ *
+ * @copyright Copyright (c) NPO baser foundation
+ * @link https://basercms.net baserCMS Project
+ * @since 5.0.0
+ * @license https://basercms.net/license/index.html MIT License
+ */
+
+namespace BcThemeConfig\Test\TestCase\ServiceProvider;
+
+use BaserCore\TestSuite\BcTestCase;
+use BcThemeConfig\Service\ThemeConfigsServiceInterface;
+use BcThemeConfig\ServiceProvider\BcThemeConfigServiceProvider;
+use Cake\Core\Container;
+
+/**
+ * Class BcThemeConfigServiceProviderTest
+ * @property BcThemeConfigServiceProvider $BcThemeConfigServiceProvider
+ */
+class BcThemeConfigServiceProviderTest extends BcTestCase
+{
+
+ /**
+ * Set Up
+ *
+ * @return void
+ */
+ public function setUp(): void
+ {
+ parent::setUp();
+ $this->BcThemeConfigServiceProvider = new BcThemeConfigServiceProvider();
+ }
+
+ /**
+ * Tear Down
+ *
+ * @return void
+ */
+ public function tearDown(): void
+ {
+ unset($this->BcThemeConfigServiceProvider);
+ parent::tearDown();
+ }
+
+ /**
+ * @test services
+ * @return void
+ */
+ public function testServices()
+ {
+ $container = new Container();
+ $this->BcThemeConfigServiceProvider->services($container);
+ $this->assertTrue($container->has(ThemeConfigsServiceInterface::class));
+ }
+}
diff --git a/plugins/bc-theme-file/src/Controller/Admin/ThemeFilesController.php b/plugins/bc-theme-file/src/Controller/Admin/ThemeFilesController.php
index 905aedc253..4910184a51 100644
--- a/plugins/bc-theme-file/src/Controller/Admin/ThemeFilesController.php
+++ b/plugins/bc-theme-file/src/Controller/Admin/ThemeFilesController.php
@@ -50,6 +50,10 @@ class ThemeFilesController extends BcAdminAppController
* @param string|null $name
* @param EventManagerInterface|null $eventManager
* @param ComponentRegistry|null $components
+ *
+ * @checked
+ * @noTodo
+ * @unitTest
*/
public function __construct(
?ServerRequest $request = null,
diff --git a/plugins/bc-theme-file/src/Controller/Api/Admin/ThemeFilesController.php b/plugins/bc-theme-file/src/Controller/Api/Admin/ThemeFilesController.php
index a24e4e9582..d59d2f4d09 100644
--- a/plugins/bc-theme-file/src/Controller/Api/Admin/ThemeFilesController.php
+++ b/plugins/bc-theme-file/src/Controller/Api/Admin/ThemeFilesController.php
@@ -31,6 +31,9 @@ class ThemeFilesController extends BcAdminApiController
* [API] テーマファイル ファイル新規追加
*
* @param ThemeFilesServiceInterface $service
+ * @checked
+ * @noTodo
+ * @unitTest
*/
public function add(ThemeFilesServiceInterface $service)
{
diff --git a/plugins/bc-theme-file/src/Controller/Api/Admin/ThemeFoldersController.php b/plugins/bc-theme-file/src/Controller/Api/Admin/ThemeFoldersController.php
index 097c1171e4..c482410958 100644
--- a/plugins/bc-theme-file/src/Controller/Api/Admin/ThemeFoldersController.php
+++ b/plugins/bc-theme-file/src/Controller/Api/Admin/ThemeFoldersController.php
@@ -37,6 +37,7 @@ class ThemeFoldersController extends BcAdminApiController
* @param ThemeFoldersService $service
* @checked
* @noTodo
+ * @unitTest
*/
public function batch(ThemeFoldersServiceInterface $service)
{
diff --git a/plugins/bc-theme-file/tests/TestCase/Controller/Admin/ThemeFilesControllerTest.php b/plugins/bc-theme-file/tests/TestCase/Controller/Admin/ThemeFilesControllerTest.php
index e42d5b91c7..da52c9655d 100644
--- a/plugins/bc-theme-file/tests/TestCase/Controller/Admin/ThemeFilesControllerTest.php
+++ b/plugins/bc-theme-file/tests/TestCase/Controller/Admin/ThemeFilesControllerTest.php
@@ -1,17 +1,20 @@
- * Copyright (c) baserCMS Users Community
+ * Copyright (c) NPO baser foundation
*
- * @copyright Copyright (c) baserCMS Users Community
- * @link https://basercms.net baserCMS Project
- * @since baserCMS v 4.0.9
- * @license https://basercms.net/license/index.html
+ * @copyright Copyright (c) NPO baser foundation
+ * @link https://basercms.net baserCMS Project
+ * @since 5.0.0
+ * @license https://basercms.net/license/index.html MIT License
*/
-App::uses('ThemeFilesController', 'Controller');
+namespace BcThemeFile\Test\TestCase\Controller\Admin;
+use BaserCore\Test\Scenario\InitAppScenario;
+use BaserCore\TestSuite\BcTestCase;
+use BaserCore\Utility\BcContainerTrait;
+use BcThemeFile\Controller\Admin\ThemeFilesController;
+use CakephpFixtureFactories\Scenario\ScenarioAwareTrait;
/**
* Class ThemeFilesControllerTest
@@ -20,15 +23,22 @@
*/
class ThemeFilesControllerTest extends BcTestCase
{
+ /**
+ * Trait
+ */
+ use ScenarioAwareTrait;
+ use BcContainerTrait;
/**
* set up
*
* @return void
*/
- public function setUp()
+ public function setUp(): void
{
parent::setUp();
+ $this->loadFixtureScenario(InitAppScenario::class);
+ $this->ThemeFilesController = new ThemeFilesController($this->loginAdmin($this->getRequest()));
}
/**
@@ -36,131 +46,170 @@ public function setUp()
*
* @return void
*/
- public function tearDown()
+ public function tearDown(): void
{
+ unset($this->ThemeFilesController);
parent::tearDown();
}
/**
- * テーマファイル一覧
+ * test __construct
*/
- public function testAdmin_index()
+ public function test__construct()
{
- $this->markTestIncomplete('このテストは、まだ実装されていません。');
+ $_tempalteTypesExpected = [
+ 'Layouts' => 'レイアウトテンプレート',
+ 'Elements' => 'エレメントテンプレート',
+ 'Emails' => 'Eメールテンプレート',
+ 'etc' => 'コンテンツテンプレート',
+ 'css' => 'スタイルシート',
+ 'js' => 'Javascript',
+ 'img' => 'イメージ'
+ ];
+ $this->assertEquals($_tempalteTypesExpected, $this->ThemeFilesController->_tempalteTypes);
}
/**
- * テーマファイル作成
+ * test beforeRender
*/
- public function testAdmin_add()
+ public function test_beforeRender()
{
- $this->markTestIncomplete('このテストは、まだ実装されていません。');
+ $this->markTestIncomplete('このテストは未実装です。');
}
/**
- * テーマファイル編集
+ * test index
*/
- public function testAdmin_edit()
+ public function test_index()
{
- $this->markTestIncomplete('このテストは、まだ実装されていません。');
+ $this->markTestIncomplete('このテストは未実装です。');
}
/**
- * ファイルを削除する
+ * test add
*/
- public function testAdmin_del()
+ public function test_add()
{
- $this->markTestIncomplete('このテストは、まだ実装されていません。');
+ $this->markTestIncomplete('このテストは未実装です。');
}
/**
- * ファイルを削除する (ajax)
+ * test edit
*/
- public function testAdmin_ajax_del()
+ public function test_edit()
{
- $this->markTestIncomplete('このテストは、まだ実装されていません。');
+ $this->markTestIncomplete('このテストは未実装です。');
}
/**
- * テーマファイル表示
+ * test delete
*/
- public function testAdmin_view()
+ public function test_delete()
{
- $this->markTestIncomplete('このテストは、まだ実装されていません。');
+ $this->markTestIncomplete('このテストは未実装です。');
}
/**
- * テーマファイルをコピーする
+ * test delete_folder
*/
- public function testAdmin_ajax_copy()
+ public function test_delete_folder()
{
- $this->markTestIncomplete('このテストは、まだ実装されていません。');
+ $this->markTestIncomplete('このテストは未実装です。');
}
/**
- * ファイルをアップロードする
+ * test view
*/
- public function testAdmin_upload()
+ public function test_view()
{
- $this->markTestIncomplete('このテストは、まだ実装されていません。');
+ $this->markTestIncomplete('このテストは未実装です。');
}
/**
- * フォルダ追加
+ * test copy
*/
- public function testAdmin_add_folder()
+ public function test_copy()
{
- $this->markTestIncomplete('このテストは、まだ実装されていません。');
+ $this->markTestIncomplete('このテストは未実装です。');
}
/**
- * フォルダ編集
+ * test copy_folder
*/
- public function testAdmin_edit_folder()
+ public function test_copy_folder()
{
- $this->markTestIncomplete('このテストは、まだ実装されていません。');
+ $this->markTestIncomplete('このテストは未実装です。');
}
/**
- * フォルダ表示
+ * test upload
*/
- public function testAdmin_view_folder()
+ public function test_upload()
{
- $this->markTestIncomplete('このテストは、まだ実装されていません。');
+ $this->markTestIncomplete('このテストは未実装です。');
}
/**
- * コアファイルを現在のテーマにコピーする
+ * test add_folder
*/
- public function testAdmin_copy_to_theme()
+ public function test_add_folder()
{
- $this->markTestIncomplete('このテストは、まだ実装されていません。');
+ $this->markTestIncomplete('このテストは未実装です。');
}
/**
- * コアファイルのフォルダを現在のテーマにコピーする
+ * test edit_folder
*/
- public function testAdmin_copy_folder_to_theme()
+ public function test_edit_folder()
{
- $this->markTestIncomplete('このテストは、まだ実装されていません。');
+ $this->markTestIncomplete('このテストは未実装です。');
}
/**
- * 画像を表示する
- * コアの画像等も表示可
+ * test view_folder
*/
- public function testAdmin_img()
+ public function test_view_folder()
{
- $this->markTestIncomplete('このテストは、まだ実装されていません。');
+ $this->markTestIncomplete('このテストは未実装です。');
}
/**
- * 画像を表示する
- * コアの画像等も表示可
+ * test copy_to_theme
*/
- public function testAdmin_img_thumb()
+ public function test_copy_to_theme()
{
- $this->markTestIncomplete('このテストは、まだ実装されていません。');
+ $this->markTestIncomplete('このテストは未実装です。');
}
+ /**
+ * test copy_folder_to_theme
+ */
+ public function test_copy_folder_to_theme()
+ {
+ $this->markTestIncomplete('このテストは未実装です。');
+ }
+
+ /**
+ * test img
+ */
+ public function test_img()
+ {
+ $this->markTestIncomplete('このテストは未実装です。');
+ }
+
+ /**
+ * test img_thumb
+ */
+ public function test_img_thumb()
+ {
+ $this->markTestIncomplete('このテストは未実装です。');
+ }
+
+ /**
+ * test parseArgs
+ */
+ public function test_parseArgs()
+ {
+ $this->markTestIncomplete('このテストは未実装です。');
+ }
}
diff --git a/plugins/bc-theme-file/tests/TestCase/Controller/Api/Admin/ThemeFoldersControllerTest.php b/plugins/bc-theme-file/tests/TestCase/Controller/Api/Admin/ThemeFoldersControllerTest.php
index b0672b8e5a..2467784eff 100644
--- a/plugins/bc-theme-file/tests/TestCase/Controller/Api/Admin/ThemeFoldersControllerTest.php
+++ b/plugins/bc-theme-file/tests/TestCase/Controller/Api/Admin/ThemeFoldersControllerTest.php
@@ -52,6 +52,36 @@ public function tearDown(): void
parent::tearDown();
}
+ /**
+ * test batch
+ */
+ public function test_batch()
+ {
+ $fullpath = BASER_PLUGINS . 'BcThemeSample' . '/templates/layout/';
+ (new Folder())->create($fullpath . 'delete_folder', 0777);
+ //APIをコール
+ $this->post('/baser/api/admin/bc-theme-file/theme_folders/batch.json?token=' . $this->accessToken,
+ [
+ 'batch' => 'delete',
+ 'batch_targets' => [$fullpath]
+ ]);
+ //レスポンスコードを確認
+ $this->assertResponseSuccess();
+ //戻る値を確認
+ $result = json_decode((string)$this->_response->getBody());
+ $this->assertEquals('一括処理が完了しました。', $result->message);
+ //実際にフォルダが削除されいてるか確認すること
+ $this->assertFalse(file_exists($fullpath . 'delete_folder'));
+
+ //$allowMethodは削除ではない場合、
+ $this->post('/baser/api/admin/bc-theme-file/theme_folders/batch.json?token=' . $this->accessToken,
+ [
+ 'batch' => 'create',
+ 'batch_targets' => [$fullpath]
+ ]);
+ $this->assertResponseCode(500);
+ }
+
/**
* [API] テーマフォルダ 一覧取得
*/