コード例 #1
0
 public function testGetUser()
 {
     Sentry::shouldReceive('getUser')->once()->withNoArgs()->andReturn(array());
     $this->assertEquals(array(), $this->auth->getUser());
     Sentry::shouldReceive('getUser')->once()->andThrow('Cartalyst\\Sentry\\Users\\UserNotFoundException');
     $this->assertFalse($this->auth->getUser());
 }
コード例 #2
0
 public function testDelete()
 {
     $mock = m::mock('Group');
     $mock->shouldReceive('delete')->once()->andReturn(true);
     Sentry::shouldReceive('findGroupById')->with(1)->once()->andReturn($mock);
     $this->assertTrue($this->groups->delete(1));
     Sentry::shouldReceive('findGroupById')->once()->andThrow('Cartalyst\\Sentry\\Groups\\GroupNotFoundException');
     $this->assertFalse($this->groups->delete(10));
 }
コード例 #3
0
 public function testDelete()
 {
     $mock = m::mock();
     Sentry::shouldReceive('findUserById')->with(1)->once()->andReturn($mock);
     $mock->shouldReceive('delete')->once()->andReturn(true);
     $this->assertTrue($this->users->delete(1));
     Sentry::shouldReceive('findUserById')->once()->andThrow('Cartalyst\\Sentry\\Users\\UserNotFoundException');
     $this->assertFalse($this->users->delete(10));
     $this->assertNotNull($this->users->getError());
 }