/** @test */ public function should_create_new_group() { $this->groups->shouldReceive('groupOfName')->once()->andReturn(null); $this->groups->shouldReceive('add')->once()->andReturn(null); $this->user->shouldReceive('id')->once()->andReturn(UserId::generate()); $this->user->shouldReceive('email')->once()->andReturn(new Email('*****@*****.**')); $this->user->shouldReceive('username')->once()->andReturn(new Username('username')); $group = $this->service->create($this->user, 'Cribbb'); $this->assertInstanceOf('Cribbb\\Domain\\Model\\Groups\\Group', $group); $this->assertEquals('Cribbb', $group->name()); $this->assertEquals(1, $group->admins()->count()); }
public function testDestroyRemovesAnUser() { User::shouldReceive('delete')->with(1)->once()->andReturn(Mockery::mock(['delete' => true])); $this->call('DELETE', 'users/1'); $this->assertRedirectedTo('users'); $this->assertSessionHas('message', 'Account disconnected'); }
/** * Test destroy route. * * @return void */ public function testDestroy() { User::shouldReceive('delete')->once()->andReturn('foo'); $response = $this->call('DELETE', 'v1/users/1'); // Assert that we got a valid Response $this->assertInstanceOf('Illuminate\\Http\\Response', $response); }