本文整理汇总了PHP中expect_not函数的典型用法代码示例。如果您正苦于以下问题:PHP expect_not函数的具体用法?PHP expect_not怎么用?PHP expect_not使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了expect_not函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testHandlePassesToAggregate
public function testHandlePassesToAggregate()
{
$command = $this->makeCommand();
$this->subject->shouldReceive('getSequence')->withNoArgs()->once()->andReturn(30);
$this->subject->shouldReceive('handle')->with($command)->once();
expect_not(RepositoryStub::handle($command));
}
示例2: testLoginCorrect
public function testLoginCorrect()
{
$this->_model = new LoginForm(['email' => 'admin@example.org', 'password' => '123123']);
expect_that($this->_model->login());
expect_not(Yii::$app->user->isGuest);
expect($this->_model->errors)->hasntKey('password');
}
示例3: testNotSendEmailsToInactiveUser
public function testNotSendEmailsToInactiveUser()
{
$user = $this->tester->grabFixture('user', 1);
$model = new PasswordResetRequestForm();
$model->email = $user['email'];
expect_not($model->sendEmail());
}
示例4: testIsSuperUser
public function testIsSuperUser()
{
$authItem = new AuthItem();
expect_not($authItem->isSuperUser());
$authItem->name = User::ROLE_SUPERUSER;
expect_that($authItem->isSuperUser());
}
示例5: 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');
}
示例6: 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'));
}
示例7: testNotCorrectSignup
public function testNotCorrectSignup()
{
$model = new SignupForm(['username' => 'troy.becker', 'email' => 'nicolas.dianna@hotmail.com', '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.');
}
示例8: 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'));
}
示例9: 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());
}
示例10: testSuccess
public function testSuccess()
{
$user = User::findByEmail('superuser@example.com');
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());
}
示例11: testPublishQueue
public function testPublishQueue()
{
$store = Mockery::mock(EventStore::class)->makePartial();
$payload = [Mockery::mock('stdClass')];
$event_name = 'testEvent';
$event = ['event' => $event_name, 'payload' => $payload];
EventBus::shouldReceive('fire')->with('publish:' . $event_name, $payload)->once();
$this->setPropertyValue($store, 'queue', [$event]);
expect_not($store->publishQueue());
$queue = $this->getPropertyValue($store, 'queue');
expect($queue)->equals([]);
}
示例12: 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'));
}
示例13: testHandleRollsBack
/**
* @expectedException Exception
*/
public function testHandleRollsBack()
{
$subject = new Middleware();
$parameter = 'request';
$callback = function ($request) use($parameter) {
expect($request)->equals($parameter);
throw new \Exception();
};
DB::shouldReceive('beginTransaction')->withNoArgs()->once();
EventStore::shouldReceive('saveQueue')->withNoArgs()->never();
DB::shouldReceive('rollBack')->withNoArgs()->once();
DB::shouldReceive('commit')->withNoArgs()->never();
expect_not($subject->handle($parameter, $callback));
}
示例14: testValidationIsSkipped
public function testValidationIsSkipped()
{
$model = new Item05();
$model->status = 'Item05Workflow/new';
expect_that($model->save());
expect_not($model->hasErrors());
$this->specify('model validation is skipped if save is done with no validation', function () use($model) {
$model->name = null;
$model->status = 'Item05Workflow/correction';
verify('save is successful when no validation is done', $model->save(false))->true();
verify('the model has no errors', $model->hasErrors())->false();
verify('the model status has changed', $model->getWorkflowStatus()->getId())->equals('Item05Workflow/correction');
verify('the status attribute has changed', $model->status)->equals('Item05Workflow/correction');
});
}
示例15: testSuccess
public function testSuccess()
{
$form = new SignupForm(['fullName' => 'Test', 'email' => 'test@test.com', 'password' => 'test_password']);
$user = $form->signup();
expect($user)->isInstanceOf('app\\models\\User');
expect_not($user->isConfirmed());
expect($user->email)->equals('test@test.com');
expect_that($user->validatePassword('test_password'));
expect_that($form->sendEmail());
$user = User::findByEmail('test@test.com');
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('editor@mail.com');
}