本文整理汇总了PHP中expect_that函数的典型用法代码示例。如果您正苦于以下问题:PHP expect_that函数的具体用法?PHP expect_that怎么用?PHP expect_that使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了expect_that函数的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: testLoginCorrect
public function testLoginCorrect()
{
$this->_model = new LoginForm(['email' => '[email protected]', 'password' => '123123']);
expect_that($this->_model->login());
expect_not(Yii::$app->user->isGuest);
expect($this->_model->errors)->hasntKey('password');
}
开发者ID:yii2mod,项目名称:base,代码行数:7,代码来源:LoginFormTest.php
示例3: testIsSuperUser
public function testIsSuperUser()
{
$authItem = new AuthItem();
expect_not($authItem->isSuperUser());
$authItem->name = User::ROLE_SUPERUSER;
expect_that($authItem->isSuperUser());
}
开发者ID:rkit,项目名称:bootstrap-yii2,代码行数:7,代码来源:AuthItemTest.php
示例4: testLoginCorrect
public function testLoginCorrect()
{
$this->model = new LoginForm(['username' => 'demo', 'password' => 'demo']);
expect_that($this->model->login());
expect_not(\Yii::$app->user->isGuest);
expect($this->model->errors)->hasntKey('password');
}
开发者ID:chizdrel,项目名称:yii2-app-basic,代码行数:7,代码来源:LoginFormTest.php
示例5: testValidateUser
/**
* @depends testFindUserByUsername
*/
public function testValidateUser($user)
{
$user = User::findByUsername('admin');
expect_that($user->validateAuthKey('test100key'));
expect_not($user->validateAuthKey('test102key'));
expect_that($user->validatePassword('admin'));
expect_not($user->validatePassword('123456'));
}
开发者ID:chizdrel,项目名称:yii2-app-basic,代码行数:11,代码来源:UserTest.php
示例6: testNotCorrectSignup
public function testNotCorrectSignup()
{
$model = new SignupForm(['username' => 'troy.becker', 'email' => '[email protected]', 'password' => 'some_password']);
expect_not($model->signup());
expect_that($model->getErrors('username'));
expect_that($model->getErrors('email'));
expect($model->getFirstError('username'))->equals('This username has already been taken.');
expect($model->getFirstError('email'))->equals('This email address has already been taken.');
}
开发者ID:yiisoft,项目名称:yii2-app-advanced,代码行数:9,代码来源:SignupFormTest.php
示例7: testValidateUser
/**
* @depends testFindUserByUsername
*/
public function testValidateUser()
{
/** @var User $user */
$user = User::find()->where(['username' => 'neo'])->one();
expect_that($user->validateAuthKey('neo'));
expect_not($user->validateAuthKey('test102key'));
//expect_that($user->validatePassword('neo'));
//expect_not($user->validatePassword('123456'));
}
开发者ID:amnah,项目名称:yii2-angular,代码行数:12,代码来源:User1Test.php
示例8: testRegister
public function testRegister()
{
$this->provider->shouldReceive('mergeConfigFrom')->with(Mockery::type('string'), 'ray_emitter')->once();
App::shouldReceive('singleton')->with('rayemitter.store', Mockery::on(function ($closure) {
$result = $closure();
expect_that($result);
expect($result instanceof Store)->true();
return true;
}))->once();
expect_not($this->provider->register());
}
开发者ID:C4Tech,项目名称:laravel-ray-emitter,代码行数:11,代码来源:ServiceProviderTest.php
示例9: testSuccess
public function testSuccess()
{
$user = User::findByEmail('[email protected]');
expect_not($user->isConfirmed());
$form = new ConfirmEmailForm();
expect_that($form->validateToken($user->email_confirm_token));
expect_that($form->confirmEmail());
$user = User::findByEmail($user->email);
expect($user->email_confirm_token)->isEmpty();
expect_that($user->isConfirmed());
}
开发者ID:rkit,项目名称:bootstrap-yii2,代码行数:11,代码来源:ConfirmEmailFormTest.php
示例10: testWorkflowAccessorSuccess
public function testWorkflowAccessorSuccess()
{
$src = new WorkflowFileSource();
$src->addWorkflowDefinition('wid', ['initialStatusId' => 'A', 'status' => ['A' => ['label' => 'label A', 'transition' => ['B', 'C']], 'B' => [], 'C' => []]]);
$w = $src->getWorkflow('wid');
verify_that($w != null);
$this->specify('initial status can be obtained through workflow', function () use($w) {
expect_that($w->getInitialStatus() instanceof StatusInterface);
expect_that($w->getInitialStatus()->getId() == $w->getInitialStatusId());
});
}
开发者ID:kenchengch,项目名称:yii2-workflow,代码行数:11,代码来源:WorkflowObjectTest.php
示例11: testUpdate
public function testUpdate()
{
$user = $this->tester->grabFixture('user', 'user-2');
$user->profile->full_name = 'Test';
$user->profile->birth_day = '2001-01-02';
expect_that($user->save());
$user = $this->tester->grabFixture('user', 'user-2');
expect($user)->isInstanceOf('app\\models\\User');
expect($user->profile->full_name)->equals('Test');
expect($user->profile->birth_day)->equals('2001-01-02');
}
开发者ID:rkit,项目名称:bootstrap-yii2,代码行数:11,代码来源:UserProfileTest.php
示例12: testSuccess
public function testSuccess()
{
$user = $this->tester->grabFixture('user', 'user-1');
$form = new ResetPasswordForm();
$form->password = 'password-new';
expect_that($form->validateToken($user->password_reset_token));
expect_that($form->resetPassword());
$user = User::findByEmail($user->email);
expect($user->password_reset_token)->isEmpty();
expect_that($user->validatePassword('password-new'));
}
开发者ID:rkit,项目名称:bootstrap-yii2,代码行数:11,代码来源:ResetPasswordFormTest.php
示例13: testCheckFakePermission
public function testCheckFakePermission()
{
$config = Yii::getAlias('@app/tests/_data/rbac/permissions.php');
$auth = Yii::$app->authManager;
$permission = $auth->createPermission('test');
$auth->add($permission);
expect_that($auth->getPermission('test'));
$command = new RbacController('test', 'test');
$command->path = $config;
$command->beforeAction('test');
$command->actionUp();
expect_not($auth->getPermission('test'));
}
开发者ID:rkit,项目名称:bootstrap-yii2,代码行数:13,代码来源:RbacTest.php
示例14: testSendEmailSuccessfully
public function testSendEmailSuccessfully()
{
$userFixture = $this->tester->grabFixture('user', 0);
$model = new PasswordResetRequestForm();
$model->email = $userFixture['email'];
$user = User::findOne(['password_reset_token' => $userFixture['password_reset_token']]);
expect_that($model->sendEmail());
expect_that($user->password_reset_token);
$emailMessage = $this->tester->grabLastSentEmail();
expect('valid email is sent', $emailMessage)->isInstanceOf('yii\\mail\\MessageInterface');
expect($emailMessage->getTo())->hasKey($model->email);
expect($emailMessage->getFrom())->hasKey(Yii::$app->params['supportEmail']);
}
开发者ID:yiisoft,项目名称:yii2-app-advanced,代码行数:13,代码来源:PasswordResetRequestFormTest.php
示例15: testLeaveNewOnDelete
public function testLeaveNewOnDelete()
{
$post = new Item06();
$post->name = 'post name';
$post->enterWorkflow();
verify($post->save())->true();
verify($post->getWorkflowStatus()->getId())->equals('Item06Workflow/new');
$post->canLeaveWorkflow(true);
Item06Behavior::$countBeforeLeaveNew = 0;
Item06Behavior::$countAfterLeaveNew = 0;
expect_that($post->delete());
expect('the beforeLeaveNew has been called once', Item06Behavior::$countBeforeLeaveNew)->equals(1);
expect('the afterLeaveNew has been called once', Item06Behavior::$countAfterLeaveNew)->equals(1);
}
开发者ID:raoul2000,项目名称:yii2-workflow,代码行数:14,代码来源:BehaviorEventHandlerTest.php
示例16: testStatusEqualsSuccess
public function testStatusEqualsSuccess()
{
$item = new Item04();
expect_that($item->statusEquals());
expect_that($item->statusEquals(null));
expect_that($item->statusEquals(''));
expect_that($item->statusEquals([]));
expect_that($item->statusEquals(0));
$item->sendToStatus('A');
expect_that($item->statusEquals('A'));
expect_that($item->statusEquals('Item04Workflow/A'));
$itself = $item->getWorkflowStatus();
expect_that($item->statusEquals($itself));
}
开发者ID:raoul2000,项目名称:yii2-workflow,代码行数:14,代码来源:StatusEqualsTest.php
示例17: testSendEmail
public function testSendEmail()
{
$model = new ContactForm();
$model->attributes = ['name' => 'Tester', 'email' => '[email protected]', 'subject' => 'very important letter subject', 'body' => 'body of current message'];
expect_that($model->sendEmail('[email protected]'));
// using Yii2 module actions to check email was sent
$this->tester->seeEmailIsSent();
$emailMessage = $this->tester->grabLastSentEmail();
expect('valid email is sent', $emailMessage)->isInstanceOf('yii\\mail\\MessageInterface');
expect($emailMessage->getTo())->hasKey('[email protected]');
expect($emailMessage->getFrom())->hasKey('[email protected]');
expect($emailMessage->getSubject())->equals('very important letter subject');
expect($emailMessage->toString())->contains('body of current message');
}
开发者ID:lanfp,项目名称:testgit2,代码行数:14,代码来源:ContactFormTest.php
示例18: testSuccess
public function testSuccess()
{
$user = $this->tester->grabFixture('user', 'user-1');
$form = new PasswordResetRequestForm();
$form->email = '[email protected]';
expect_that($form->validate());
expect_that($form->sendEmail());
$user = User::findOne(['password_reset_token' => $user->password_reset_token]);
expect($user->password_reset_token)->notNull();
$message = $this->tester->grabLastSentEmail();
expect('valid email is sent', $message)->isInstanceOf('yii\\mail\\MessageInterface');
expect($message->getTo())->hasKey($form->email);
expect($message->getFrom())->hasKey('[email protected]');
}
开发者ID:rkit,项目名称:bootstrap-yii2,代码行数:14,代码来源:PasswordResetRequestFormTest.php
示例19: testEmailIsSentOnContact
public function testEmailIsSentOnContact()
{
/** @var ContactForm $model */
$this->model = $this->getMockBuilder('app\\models\\ContactForm')->setMethods(['validate'])->getMock();
$this->model->expects($this->once())->method('validate')->will($this->returnValue(true));
$this->model->attributes = ['name' => 'Tester', 'email' => '[email protected]', 'subject' => 'very important letter subject', 'body' => 'body of current message'];
expect_that($this->model->contact('[email protected]'));
// using Yii2 module actions to check email was sent
$this->tester->seeEmailIsSent();
$emailMessage = $this->tester->grabLastSentEmail();
expect('valid email is sent', $emailMessage)->isInstanceOf('yii\\mail\\MessageInterface');
expect($emailMessage->getTo())->hasKey('[email protected]');
expect($emailMessage->getFrom())->hasKey('[email protected]');
expect($emailMessage->getSubject())->equals('very important letter subject');
expect($emailMessage->toString())->contains('body of current message');
}
开发者ID:chizdrel,项目名称:yii2-app-basic,代码行数:16,代码来源:ContactFormTest.php
示例20: testSuccess
public function testSuccess()
{
$form = new SignupForm(['fullName' => 'Test', 'email' => '[email protected]', 'password' => 'test_password']);
$user = $form->signup();
expect($user)->isInstanceOf('app\\models\\User');
expect_not($user->isConfirmed());
expect($user->email)->equals('[email protected]');
expect_that($user->validatePassword('test_password'));
expect_that($form->sendEmail());
$user = User::findByEmail('[email protected]');
expect($user->profile->full_name)->equals('Test');
$message = $this->tester->grabLastSentEmail();
expect('valid email is sent', $message)->isInstanceOf('yii\\mail\\MessageInterface');
expect($message->getTo())->hasKey($user->email);
expect($message->getFrom())->hasKey('[email protected]');
}
开发者ID:rkit,项目名称:bootstrap-yii2,代码行数:16,代码来源:SignupFormTest.php
注:本文中的expect_that函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论