Skip to content

Commit

Permalink
Merge pull request #3956 from thangnnmd/unitTest_BcContentsBehavior_g…
Browse files Browse the repository at this point in the history
…etType

BcContentsBehavior::getType
  • Loading branch information
HungDV2022 authored Nov 12, 2024
2 parents e5f6dab + 729b23a commit f7fab89
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public function initialize(array $config): void
* @return string
* @checked
* @noTodo
* @unitTest
*/
public function getType(): string
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}

}

0 comments on commit f7fab89

Please sign in to comment.