Skip to content

Commit

Permalink
AppTable::addPrefix() ユニットテスト調整 (#3816)
Browse files Browse the repository at this point in the history
Co-authored-by: Đỗ Văn Hùng <[email protected]>
  • Loading branch information
HungDV2022 and dovanhung authored Sep 18, 2024
1 parent 3ea31cb commit 019dadf
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions plugins/baser-core/src/Model/Table/AppTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ public function belongsToMany(string $associated, array $options = []): BelongsT
* @return string
* @checked
* @noTodo
* @unitTest
*/
public function addPrefix($table)
{
Expand Down
18 changes: 18 additions & 0 deletions plugins/baser-core/tests/TestCase/Model/Table/AppTableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
}

}

0 comments on commit 019dadf

Please sign in to comment.