/** @test */ public function should_create_new_post() { $user = m::mock('Cribbb\\Domain\\Model\\Identity\\User'); $thread = m::mock('Cribbb\\Domain\\Model\\Discussion\\Thread'); $post = m::mock('Cribbb\\Domain\\Model\\Discussion\\Post'); $this->users->shouldReceive('userById')->once()->andReturn($user); $this->threads->shouldReceive('threadById')->once()->andReturn($thread); $thread->shouldReceive('createNewPost')->once()->andReturn($post); $this->posts->shouldReceive('add')->once(); $post = $this->service->create('7c5e8127-3f77-496c-9bb4-5cb092969d89', 'a3d9e532-0ea8-4572-8e83-119fc49e4c6f', 'Hello World'); $this->assertInstanceOf('Cribbb\\Domain\\Model\\Discussion\\Post', $post); }