/** @test */ public function should_create_post() { $this->group->addMember($this->user); $thread = new Thread(ThreadId::generate(), $this->group, 'Hello World'); $post = $thread->createNewPost($this->user, 'Once upon a time...'); $this->assertInstanceOf('Cribbb\\Domain\\Model\\Discussion\\Post', $post); }
/** @test */ public function should_create_a_new_thread() { $group = new Group(GroupId::generate(), 'Cribbb'); $group->addMember($this->user); $thread = $group->startNewThread($this->user, 'Hello World'); $this->assertInstanceOf('Cribbb\\Domain\\Model\\Discussion\\Thread', $thread); $this->assertEquals(1, $group->threads()->count()); }
/** * Add the User as a Member of a Group * * @param Group $group * @return void */ public function addAsMemberOf(Group $group) { $this->memberOf[] = $group; $group->addMember($this); }