diff --git a/plugins/baser-core/src/Model/Table/AppTable.php b/plugins/baser-core/src/Model/Table/AppTable.php index b9e18cfef6..4920dfe867 100755 --- a/plugins/baser-core/src/Model/Table/AppTable.php +++ b/plugins/baser-core/src/Model/Table/AppTable.php @@ -125,6 +125,7 @@ public function belongsToMany(string $associated, array $options = []): BelongsT * @return string * @checked * @noTodo + * @unitTest */ public function addPrefix($table) { diff --git a/plugins/baser-core/tests/TestCase/Model/Table/AppTableTest.php b/plugins/baser-core/tests/TestCase/Model/Table/AppTableTest.php index 3e961591ec..6f6c297e4d 100644 --- a/plugins/baser-core/tests/TestCase/Model/Table/AppTableTest.php +++ b/plugins/baser-core/tests/TestCase/Model/Table/AppTableTest.php @@ -297,4 +297,22 @@ public function testSortdown() $this->assertEquals(2, $Plugins->get(2)->priority); } + /** + * test addPrefix + * @return void + */ + public function testAddPrefix() + { + //デフォルトテーブル + $this->assertEquals('plugin', $this->App->addPrefix('plugin')); + + //プレフィックスを追加場合、 + $dbConfig = BcUtil::getCurrentDbConfig(); + $dbConfig['prefix'] = 'unittest_'; + $connection = new Connection($dbConfig); + $this->App = $this->getTableLocator()->get('BaserCore.App')->setConnection($connection); + + $this->assertEquals('unittest_plugin', $this->App->addPrefix('plugin')); + } + }