diff --git a/plugins/baser-core/src/Model/Behavior/BcContentsBehavior.php b/plugins/baser-core/src/Model/Behavior/BcContentsBehavior.php index 13d1346b8d..af72b828c8 100644 --- a/plugins/baser-core/src/Model/Behavior/BcContentsBehavior.php +++ b/plugins/baser-core/src/Model/Behavior/BcContentsBehavior.php @@ -75,6 +75,7 @@ public function initialize(array $config): void * @return string * @checked * @noTodo + * @unitTest */ public function getType(): string { diff --git a/plugins/baser-core/tests/TestCase/Model/Behavior/BcContentsBehaviorTest.php b/plugins/baser-core/tests/TestCase/Model/Behavior/BcContentsBehaviorTest.php index f8f1b27738..6d719741c5 100644 --- a/plugins/baser-core/tests/TestCase/Model/Behavior/BcContentsBehaviorTest.php +++ b/plugins/baser-core/tests/TestCase/Model/Behavior/BcContentsBehaviorTest.php @@ -13,6 +13,8 @@ use ArrayObject; use BaserCore\Test\Scenario\ContentFoldersScenario; use BaserCore\Test\Scenario\ContentsScenario; +use BaserCore\Utility\BcUtil; +use Cake\Database\Connection; use Cake\ORM\Entity; use BaserCore\TestSuite\BcTestCase; use BaserCore\Service\ContentsService; @@ -231,4 +233,27 @@ public function testOffAlias() $this->assertEquals('ContentFolder', $conditions['Contents.type']); } + /** + * test getType + */ + public function testGetType() + { + //prefix = "" + $this->table->setTable('unittest_baser_contents'); + $rs = $this->BcContentsBehavior->getType(); + //戻り確認 + $this->assertEquals('UnittestBaserContent', $rs); + + //prefix = "unittest_" + $dbConfig = BcUtil::getCurrentDbConfig(); + $dbConfig['prefix'] = 'unittest_'; + $connection = new Connection($dbConfig); + $this->table->setConnection($connection); + $this->table->setTable('unittest_baser_contents'); + + $rs = $this->BcContentsBehavior->getType(); + //戻り確認 + $this->assertEquals('BaserContent', $rs); + } + }