8ec727c1
曹明
初始化代码提交
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
<?php
use Codeception\Util\Stub;
class ModuleTest extends \PHPUnit_Framework_TestCase
{
public function testRequirements()
{
$module = Stub::make('ModuleStub');
try {
$module->_setConfig([]);
} catch (\Exception $e) {
$this->assertContains('"error"', $e->getMessage());
$this->assertContains('no\such\class', $e->getMessage());
$this->assertContains('composer', $e->getMessage());
$this->assertNotContains('installed', $e->getMessage());
return;
}
$this->fail('no exception thrown');
}
}
class ModuleStub extends \Codeception\Module implements \Codeception\Lib\Interfaces\RequiresPackage
{
public function _requires()
{
return ['no\such\class' => '"error"', 'Codeception\Module' => '"installed"'];
}
}
|