Skip to content

Commit

Permalink
BcAbstractDetector::find() ユニットテスト (baserproject#3780)
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 8, 2024
1 parent bf59546 commit 1155b06
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 0 deletions.
1 change: 1 addition & 0 deletions plugins/baser-core/src/Utility/BcAbstractDetector.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public function __construct($name, array $config)
* @return BcAbstractDetector|null
* @checked
* @noTodo
* @unitTest
*/
public static function find($name)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<?php
/**
* baserCMS : Based Website Development Project <https://basercms.net>
* Copyright (c) NPO baser foundation <https://baserfoundation.org/>
*
* @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 BaserCore\Test\TestCase\Utility;

use BaserCore\TestSuite\BcTestCase;
use BaserCore\Utility\BcAgent;
use Cake\Core\Configure;

/**
* Class BcAbstractDetector
*
*/
class BcAbstractDetectorTest extends BcTestCase
{

/**
* set up
*/
public function setUp(): void
{
parent::setUp();
}

/**
* tearDown
*
* @return void
*/
public function tearDown(): void
{
parent::tearDown();
}

/**
* test find
*/
public function testFind()
{
Configure::write("BcApp.smartphone", true);

//Configureにnameがある場合、
$rs = BcAgent::find('smartphone');
$this->assertEquals('smartphone', $rs->name);
$this->assertEquals('device', $rs->type);

//Configureにnameがない場合、
$this->assertNull(BcAgent::find('test'));
}

/**
* test findAll
*/
public function testFindAll()
{
$this->markTestIncomplete('このテストは、まだ実装されていません。');
}

/**
* test findCurrent
*/
public function testFindCurrent()
{
$this->markTestIncomplete('このテストは、まだ実装されていません。');
}
}

0 comments on commit 1155b06

Please sign in to comment.