本文整理汇总了PHP中expect函数的典型用法代码示例。如果您正苦于以下问题:PHP expect函数的具体用法?PHP expect怎么用?PHP expect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了expect函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: testConstructSuccess
public function testConstructSuccess()
{
$this->specify('Workflow source construct default', function () {
$src = new WorkflowFileSource();
expect($src->getClassMapByType(WorkflowFileSource::TYPE_WORKFLOW))->equals('raoul2000\\workflow\\base\\Workflow');
expect($src->getClassMapByType(WorkflowFileSource::TYPE_STATUS))->equals('raoul2000\\workflow\\base\\Status');
expect($src->getClassMapByType(WorkflowFileSource::TYPE_TRANSITION))->equals('raoul2000\\workflow\\base\\Transition');
expect($src->getDefinitionCache())->equals(null);
expect($src->getDefinitionLoader())->notNull();
});
$this->specify('Workflow source construct with class map', function () {
$src = new WorkflowFileSource(['classMap' => [WorkflowFileSource::TYPE_WORKFLOW => 'my\\namespace\\Workflow', WorkflowFileSource::TYPE_STATUS => 'my\\namespace\\Status', WorkflowFileSource::TYPE_TRANSITION => 'my\\namespace\\Transition']]);
expect($src->getClassMapByType(WorkflowFileSource::TYPE_WORKFLOW))->equals('my\\namespace\\Workflow');
expect($src->getClassMapByType(WorkflowFileSource::TYPE_STATUS))->equals('my\\namespace\\Status');
expect($src->getClassMapByType(WorkflowFileSource::TYPE_TRANSITION))->equals('my\\namespace\\Transition');
});
$this->specify('Workflow source construct with cache', function () {
// initialized by array
$src = new WorkflowFileSource(['definitionCache' => ['class' => 'yii\\caching\\FileCache']]);
expect_that($src->getDefinitionCache() instanceof yii\caching\FileCache);
// initialized by component ID
Yii::$app->set('myCache', ['class' => 'yii\\caching\\FileCache']);
$src = new WorkflowFileSource(['definitionCache' => 'myCache']);
expect_that($src->getDefinitionCache() instanceof yii\caching\FileCache);
// initialized by object
$cache = Yii::$app->get('myCache');
Yii::$app->set('myCache', ['class' => 'yii\\caching\\FileCache']);
$src = new WorkflowFileSource(['definitionCache' => $cache]);
expect_that($src->getDefinitionCache() instanceof yii\caching\FileCache);
});
}
开发者ID:raoul2000,项目名称:yii2-workflow,代码行数:31,代码来源:WorkflowFileSourceTest.php
示例2: testItems
public function testItems()
{
$this->specify("Попытка получить список операторов", function () {
$items = ['operator1' => 'Оператор 1', 'operator2' => 'Оператор 2'];
expect("Список должен состоять из пар идентификатор - имя", Operator::items())->equals($items);
});
}
开发者ID:shubnikofff,项目名称:mobiles,代码行数:7,代码来源:OperatorTest.php
示例3: testLoginCorrect
public function testLoginCorrect()
{
$model = new LoginForm(['username' => 'bayer.hudson', 'password' => 'password_0']);
expect('model should login user', $model->login())->true();
expect('error message should not be set', $model->errors)->hasntKey('password');
expect('user should be logged in', Yii::$app->user->isGuest)->false();
}
开发者ID:yiisoft,项目名称:yii2-app-advanced,代码行数:7,代码来源:LoginFormTest.php
示例4: testValidateCorrect
public function testValidateCorrect()
{
$model = new Article(['name' => 'name', 'text' => 'text', 'created_at' => 'created_at', 'updated_at' => 'updated_at', 'user_id' => null]);
$this->specify('event wrong', function () use($model) {
expect('model should not validate', $model->validate())->true();
});
}
开发者ID:vitalik74,项目名称:event-app,代码行数:7,代码来源:ArticleTest.php
示例5: testChangeUserName
public function testChangeUserName()
{
$user = User::find()->where(['username' => 'neo'])->one();
$user->username = "neozzz";
$user->save();
expect($user->username)->equals('neozzz');
}
开发者ID:amnah,项目名称:yii2-angular,代码行数:7,代码来源:User1Test.php
示例6: itCallsTheDriverForConnexion
public function itCallsTheDriverForConnexion()
{
$openid_url = "https://www.google.com/accounts/o8/id";
$return_to_url = "http://example.net";
expect($this->driver)->connect($openid_url, $return_to_url)->once();
$this->connexion_manager->startAuthentication($openid_url, $return_to_url);
}
开发者ID:pombredanne,项目名称:tuleap,代码行数:7,代码来源:ConnexionManagerTest.php
示例7: itRemovesAllIncludedGroups
public function itRemovesAllIncludedGroups()
{
$groupname = "parent group";
$url_get_members = $this->gerrit_server_host . ':' . $this->gerrit_server_port . '/a/groups/' . urlencode($groupname) . '/groups';
$response_with_included_groups = <<<EOS
)]}'
[
{
"kind": "gerritcodereview#group",
"url": "#/admin/groups/uuid-6ef56904c11e6d53c8f2f3657353faaac74bfc6d",
"options": {},
"group_id": 7,
"owner": "enalean",
"owner_id": "6ef56904c11e6d53c8f2f3657353faaac74bfc6d",
"id": "6ef56904c11e6d53c8f2f3657353faaac74bfc6d",
"name": "enalean"
},
{
"kind": "gerritcodereview#group",
"url": "#/admin/groups/uuid-b99e4455ca98f2ec23d9250f69617e34ceae6bd6",
"options": {},
"group_id": 6,
"owner": "another group",
"owner_id": "b99e4455ca98f2ec23d9250f69617e34ceae6bd6",
"id": "b99e4455ca98f2ec23d9250f69617e34ceae6bd6",
"name": "another group"
}
]
EOS;
stub($this->guzzle_client)->get($url_get_members, '*')->returns($this->getGuzzleRequestWithTextResponse($response_with_included_groups));
$url = $this->gerrit_server_host . ':' . $this->gerrit_server_port . '/a/groups/' . urlencode($groupname) . '/groups.delete';
expect($this->guzzle_client)->post($url, array(Git_Driver_GerritREST::HEADER_CONTENT_TYPE => Git_Driver_GerritREST::MIME_JSON, 'verify' => false), json_encode(array('groups' => array('enalean', 'another group'))))->once();
stub($this->guzzle_client)->post()->returns($this->guzzle_request);
$this->driver->removeAllIncludedGroups($this->gerrit_server, $groupname);
}
开发者ID:pombredanne,项目名称:tuleap,代码行数:35,代码来源:GerritREST_removeIncludedGroupTestPHP53.php
示例8: testValidateCorrect
public function testValidateCorrect()
{
$model = new Event(['type' => 'Type', 'name' => 'Name', 'event' => 'Event', 'title' => 'Title']);
$this->specify('event wrong', function () use($model) {
expect('model should not validate', $model->validate())->true();
});
}
开发者ID:vitalik74,项目名称:event-app,代码行数:7,代码来源:EventTest.php
示例9: itCallsTheRightOptions
public function itCallsTheRightOptions()
{
$url = $this->gerrit_server_host . ':' . $this->gerrit_server_port . '/a/projects/' . urlencode($this->project_name);
expect($this->guzzle_client)->get($url, '*')->once();
stub($this->guzzle_client)->get()->returns($this->guzzle_request);
$this->driver->doesTheParentProjectExist($this->gerrit_server, $this->project_name);
}
开发者ID:pombredanne,项目名称:tuleap,代码行数:7,代码来源:GerritREST_projectExistsTestPHP53.php
示例10: connectThrowsConnectionFailureOnFailure
/**
* @test
* @since 6.0.0
*/
public function connectThrowsConnectionFailureOnFailure()
{
$socket = createSocket('localhost', 80)->openWith(NewCallable::of('fsockopen')->mapCall(false));
expect(function () use($socket) {
$socket->connect();
})->throws(ConnectionFailure::class);
}
开发者ID:stubbles,项目名称:stubbles-peer,代码行数:11,代码来源:SocketTest.php
示例11: testBatchRemoveForCompositePrimaryKey
public function testBatchRemoveForCompositePrimaryKey()
{
$ids = [];
$depart = new UserDepartmentAssignment();
$depart->userId = 1;
$depart->departmentId = 2;
$depart->save(false);
$ids[] = ['userId' => $depart->userId, 'departmentId' => $depart->departmentId];
$depart = new UserDepartmentAssignment();
$depart->userId = 3;
$depart->departmentId = 5;
$depart->save(false);
$ids[] = ['departmentId' => $depart->departmentId, 'userId' => $depart->userId];
for ($i = 0; $i < 2; $i++) {
$depart = new UserDepartmentAssignment();
$depart->userId = $i + 1;
$depart->departmentId = $i * 2;
}
Yii::$app->request->setBodyParams($ids);
$this->specify('Remove a AR with single primary key', function () {
$action = new BatchRemoveAction("batch-remove", null, ['modelClass' => 'tests\\codeception\\unit\\models\\base\\UserDepartmentAssignment']);
$n = $action->run();
expect("Number of deleted records should be 2: ", $n)->equals(2);
});
}
开发者ID:fproject,项目名称:yii2-restx,代码行数:25,代码来源:BatchRemoveActionTest.php
示例12: testToString
/**
* @dataProvider values
* @param $operator
* @param $result
* @param $expression
*/
public function testToString($operator, $result, $expression)
{
$operator = new Parentheses($operator);
expect("expression " . $expression, $operator->render())->equals($expression);
expect("expression " . $expression, (string) $operator)->equals($expression);
codecept_debug($operator->render());
}
开发者ID:lrusev,项目名称:formula,代码行数:13,代码来源:BracketParenthesesTest.php
示例13: testTextDynamicStringCustomDelimeter
/**
* Tests the dynamic function
*
* @author Stanislav Kiryukhin <[email protected]>
* @since 2015-07-01
*/
public function testTextDynamicStringCustomDelimeter()
{
$actual = PhTText::dynamic('(Hi|Hello), my name is a Bob!', '(', ')');
expect($actual)->notContains('(');
expect($actual)->notContains(')');
expect(preg_match('/^(Hi|Hello), my name is a Bob!$/', $actual))->equals(1);
}
开发者ID:lisong,项目名称:cphalcon,代码行数:13,代码来源:TextDynamicTest.php
示例14: itDelegatesTheDuplicationToTheDao
public function itDelegatesTheDuplicationToTheDao()
{
$to_transition_id = 2;
$field_mapping = array();
expect($this->dao)->duplicate($this->transition_id, $to_transition_id)->once();
$this->factory->duplicate($this->transition, $to_transition_id, $field_mapping);
}
开发者ID:pombredanne,项目名称:tuleap,代码行数:7,代码来源:Transition_PostAction_CIBuildFactoryTest.php
示例15: itAddsDefaultProjectMappingIfProjectMappingDoesNotExist
public function itAddsDefaultProjectMappingIfProjectMappingDoesNotExist()
{
$event = $this->aSystemEventWithParameter('101::103::2');
stub($this->actions)->checkProjectMappingExists(101)->returns(false);
expect($this->actions)->initializeProjetMapping(101)->once();
$this->assertTrue($event->process());
}
开发者ID:pombredanne,项目名称:tuleap,代码行数:7,代码来源:SystemEvent_FULLTEXTSEARCH_DOCMAN_WIKI_INDEXTest.php
示例16: itDelegatesFormattingToValues
public function itDelegatesFormattingToValues()
{
expect($this->v1)->fetchFormattedForJson()->once();
expect($this->v2)->fetchFormattedForJson()->once();
stub($this->bind)->getAllValues()->returns(array($this->v1, $this->v2));
$this->bind->fetchFormattedForJson();
}
开发者ID:pombredanne,项目名称:tuleap,代码行数:7,代码来源:Tracker_FormElement_Field_List_BindTest.php
示例17: testFileAdapter
public function testFileAdapter()
{
$translate = new File(DATA_PATH . '/i18n/en.php');
$this->specify('Adapter will load translations from php file that return array with key, value pairs', function () use($translate) {
expect($translate->query('word.hello'))->equals('hello');
});
}
开发者ID:nexik,项目名称:nest-core,代码行数:7,代码来源:FileTest.php
示例18: itStopsTheExecutionWhenThereIsARemainingSystemEventRunning
public function itStopsTheExecutionWhenThereIsARemainingSystemEventRunning()
{
stub($this->process_manager)->isAlreadyRunning($this->process)->returns(true);
expect($this->response)->error('There is still an event marked as running. Start again when all events marked as running are done.')->once();
expect($this->response)->abort()->once();
$this->command->execute();
}
开发者ID:pombredanne,项目名称:tuleap,代码行数:7,代码来源:CheckRunningEventsTest.php
示例19: itSavesNothingIfThereAreNoProjectLanguageAndMoreThanOneSystemLanguage
public function itSavesNothingIfThereAreNoProjectLanguageAndMoreThanOneSystemLanguage()
{
ForgeConfig::set('sys_supported_languages', 'it_IT,ja_JP');
stub($this->dao)->getUsedLanguageForProject()->returns(false);
expect($this->dao)->updateLanguageOption()->never();
$this->language_manager->getUsedLanguageForProject($this->project);
}
开发者ID:pombredanne,项目名称:tuleap,代码行数:7,代码来源:MediawikiLanguageManagerTest.php
示例20: testEscapeIdentifier
/**
* Tests Mysql::escapeIdentifier
*
* @author Sid Roberts <[email protected]>
* @since 2016-11-19
*/
public function testEscapeIdentifier()
{
$this->specify('Identifiers are not properly escaped', function ($identifier, $expected) {
$escapedIdentifier = $this->connection->escapeIdentifier($identifier);
expect($escapedIdentifier)->equals($expected);
}, ["examples" => [["identifier" => "robots", "expected" => "`robots`"], ["identifier" => ["schema", "robots"], "expected" => "`schema`.`robots`"], ["identifier" => "`robots`", "expected" => "```robots```"], ["identifier" => ["`schema`", "rob`ots"], "expected" => "```schema```.`rob``ots`"]]]);
}
开发者ID:phalcon,项目名称:cphalcon,代码行数:13,代码来源:MysqlTest.php
注:本文中的expect函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论