本文整理汇总了PHP中Codeception\Util\Stub::make方法的典型用法代码示例。如果您正苦于以下问题:PHP Stub::make方法的具体用法?PHP Stub::make怎么用?PHP Stub::make使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Codeception\Util\Stub
的用法示例。
在下文中一共展示了Stub::make方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: makeTestCase
protected function makeTestCase($file, $name = '')
{
return Stub::make('\Codeception\Lib\DescriptiveTestCase', [
'getReportFields' => ['file' => codecept_root_dir() . $file],
'getName' => $name]
);
}
示例2: setStubResponse
private function setStubResponse($response)
{
$connectionModule = Stub::make('\\Codeception\\Module\\UniversalFramework', ['_getResponseContent' => $response]);
$this->module->_inject($connectionModule);
$this->module->_initialize();
$this->module->_before(Stub::makeEmpty('\\Codeception\\TestCase\\Cest'));
}
示例3: testDispatchMethod
public function testDispatchMethod()
{
$separator = Storage::$separator;
$method = self::getPrivateMethod('dispatch');
$structure = $method->invoke(Stub::make(self::$class), "base{$separator}inner{$separator}key");
$this->assertEquals($structure, array('base', 'inner', 'key'), 'Parsing of the passed path is failed');
}
示例4: testHaveAndSeeInDatabase
public function testHaveAndSeeInDatabase()
{
$this->module->haveInDatabase('users', array('name' => 'john'));
$this->module->seeInDatabase('users', array('name' => 'john'));
$this->module->_before(\Codeception\Util\Stub::make('\\Codeception\\TestCase'));
$this->module->dontSeeInDatabase('users', array('name' => 'john'));
}
示例5: create
/**
* @return Client
*/
private static function create()
{
/** @var Delivery $delivery */
$delivery = Stub::make('ArchiDelivery\\Delivery');
$client = new Client($delivery);
return $client;
}
示例6: run
public function run(CodeGuy $I)
{
$I->wantTo('run steps from scenario');
$I->haveStub($test = Stub::makeEmpty('\\Codeception\\TestCase\\Cept'));
$I->haveStub($scenario = Stub::make('\\Codeception\\Scenario', array('test' => $test, 'steps' => Stub::factory('\\Codeception\\Step', 2))));
$I->executeTestedMethodOn($scenario)->seeMethodInvoked($test, 'runStep')->seePropertyEquals($scenario, 'currentStep', 1);
}
示例7: testCreateInstanceWithRingPHP
public function testCreateInstanceWithRingPHP()
{
$log = $trace = Stub::make('\\Monolog\\Logger', []);
$ringphp_handler = Stub::make('WyriHaximus\\React\\RingPHP\\HttpClientAdapter');
$connection = new Guzzle5Connection(['host' => 'localhost', 'port' => 9200, 'ringphp_handler' => $ringphp_handler], null, $log, $trace);
$this->assertInstanceOf('Iwai\\Elasticsearch\\Guzzle5Connection', $connection);
}
示例8: setStubResponse
private function setStubResponse($response)
{
$this->phpBrowser = Stub::make('\\Codeception\\Module\\PhpBrowser', ['_getResponseContent' => $response]);
$this->module->_inject($this->phpBrowser);
$this->module->_initialize();
$this->module->_before(Stub::makeEmpty('\\Codeception\\TestCase\\Cest'));
}
示例9: test_unserialize_real_serialized_object
public function test_unserialize_real_serialized_object()
{
$user = Stub::make('StdClass', array('username' => 'username', 'email' => 'email@example.com'));
$so = new SerializedObject(serialize($user));
$result = $so->unserialize();
$this->assertEquals($result->username, 'username');
$this->assertEquals($result->email, 'email@example.com');
}
示例10: testHaveAndSeeInDatabase
public function testHaveAndSeeInDatabase()
{
$user_id = $this->module->haveInDatabase('users', array('name' => 'john', 'email' => 'john@jon.com'));
$this->assertInternalType('integer', $user_id);
$this->module->seeInDatabase('users', array('name' => 'john', 'email' => 'john@jon.com'));
$this->module->_after(\Codeception\Util\Stub::make('\Codeception\TestCase'));
$this->module->dontSeeInDatabase('users', array('name' => 'john'));
}
示例11: convertWithException
public function convertWithException(\CodeGuy $I)
{
$I->wantTo("test if converting of different measure types fails.");
$I->haveStub($converter = Stub::make($this->class));
$I->amTestingMethod('\\Measure\\Converter.convert');
$I->executeTestedMethodOn($converter, 1, 'liter', 'kg');
$I->seeExceptionThrown('\\ErrorException');
}
示例12: testGetHttpClient
public function testGetHttpClient()
{
/** @var \AwesomeMotive\Drip\Token $token */
$token = Stub::make("\\AwesomeMotive\\Drip\\Token", ['get_accessToken' => '1234']);
$this->drip->set_token($token);
$client = $this->drip->get_httpClient();
$this->assertInstanceOf("\\GuzzleHttp\\Client", $client);
}
示例13: testGetDocumentsIdsReturnsEmptyArray
public function testGetDocumentsIdsReturnsEmptyArray()
{
$query = Stub::make(SearchQuery::class, ['getFilters' => function () {
return [];
}]);
$this->object = new ResultSet($query, []);
$this->assertSame([], $this->object->getDocumentIds());
}
示例14: testMake
public function testMake()
{
$dummy = Stub::make('DummyClass', array('goodByeWorld' => function () {
return 'hello world';
}));
$this->assertEquals($this->dummy->helloWorld(), $dummy->helloWorld());
$this->assertEquals("hello world", $dummy->goodByeWorld());
}
示例15: setUp
protected function setUp()
{
$this->moduleContainer = new ModuleContainer(Stub::make('Codeception\\Lib\\Di'), []);
$this->moduleContainer->create('EmulateModuleHelper');
$this->modules = $this->moduleContainer->all();
$this->actions = $this->moduleContainer->getActions();
$this->makeCommand('\\Codeception\\Command\\GenerateScenarios');
$this->config = array('paths' => array('tests' => 'tests/data/claypit/tests/', 'data' => '_data'), 'class_name' => 'DumbGuy', 'path' => 'tests/data/claypit/tests/dummy/');
}