我设计了一个加载组件的代码测试,....我有以下测试文件
<?php
namespace tests\codeception\common;
use Yii;
class FoursquareTest extends \Codeception\TestCase\Test
{
public $appConfig = '@tests/codeception/config/common/unit.php';
public function setUp()
{
parent::setUp();
$config = [
'components' => [
'foursquare' =>
[
'class' => 'garyrutland\foursquare\Foursquare',
'clientId' => '',
'secret' => ''
]
]];
Yii::configure(Yii::$app, $config);
}
// tests
public function testSearch()
{
//$this->assertInstanceOf('garyrutland\\foursquare\\Foursquare', Yii::$app->foursquare);
}
public function fixtures()
{
return [
'foursquare' => [
'class' => FoursquareFixture::className()
],
];
}
}
但是当我跑步时
codecept run unit FoursquareTest.php -vv
我得到了
PHPUnit_Framework_Exception:从空值
创建默认对象#1 /path/to/htdocs/yii/vendor/yiisoft/yii2/BaseYii.php:518
#2 /path/to/htdocs/yii/tests/codeception/common/unit/FoursquareTest.php:22
我直接实例化Foursquare类虽然没有问题....
我知道创建的对象错误