Skip to content

Commit

Permalink
Add test for Yii::createObject(); (yiisoft#15129)
Browse files Browse the repository at this point in the history
  • Loading branch information
lav45 authored and samdark committed Nov 14, 2017
1 parent a66533b commit 988440c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/framework/BaseYiiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,22 @@ public function testCreateObjectCallable()
}));
}

public function testCreateObjectEmptyArrayException()
{
$this->expectException('yii\base\InvalidConfigException');
$this->expectExceptionMessage('Object configuration must be an array containing a "class" element.');

Yii::createObject([]);
}

public function testCreateObjectInvalidConfigException()
{
$this->expectException('yii\base\InvalidConfigException');
$this->expectExceptionMessage('Unsupported configuration type: ' . gettype(null));

Yii::createObject(null);
}

/**
* @covers \yii\BaseYii::setLogger()
* @covers \yii\BaseYii::getLogger()
Expand Down

0 comments on commit 988440c

Please sign in to comment.