/** * @test */ public function it_is_serializable() { $id = CommitteeId::generate(); $memberId = MemberId::generate(); $event = new MemberLeftCommittee($id, $memberId); $this->assertEquals($event, MemberLeftCommittee::deserialize($event->serialize())); $this->assertEquals($id, $event->committeeId()); $this->assertEquals($memberId, $event->memberId()); }
/** * Run the database seeds. * * @return void */ public function run() { $repo = App::make(Committees\CommitteeRepository::class); $faker = App::make(Faker\Generator::class); $faker->addProvider(new \DavidBadura\FakerMarkdownGenerator\FakerProvider($faker)); for ($i = 0; $i < 10; $i++) { $id = Committees\CommitteeId::generate(); $committee = Committees\Committee::instantiate($id, $faker->name, $faker->paragraph); $committee->setCommitteePage($faker->markdown); $committee->setEmail(new Email('*****@*****.**')); $repo->save($committee); } }
public function store(Request $req, CommitteeRepository $repo) { $id = CommitteeId::generate(); $committee = Committee::instantiate($id, $req->input('name'), $req->input('summary')); $committee->setCommitteePage($req->input('page')); $email = $req->input('email'); if (!empty($email)) { $committee->setEmail(new Email($req->input('email'))); } else { $committee->setEmail(null); } $repo->save($committee); return redirect('/admin/committee'); }
protected function createInstance() { return new CommitteeInstantiated(CommitteeId::generate(), 'name', 'goal'); }
protected function createInstance() { return new CommitteeEmailChanged(CommitteeId::generate(), new Email("*****@*****.**")); }
protected function createInstance() { return new CommitteeNameChanged(CommitteeId::generate(), 'S[ck]rip(t|t?c)ie 2'); }
protected function createInstance() { return new CommitteePageChanged(CommitteeId::generate(), '# Title\\nPlain text'); }
/** @test */ function it_stores_information_about_members() { $this->members->save(new MemberList($memberId = new MemberId('6bd3f9b9-b910-4d4c-89ea-2f9af285c9bf'), 'Mark', 'Redeman')); $id = CommitteeId::generate(); $this->scenario->given([new CommitteeInstantiated($id, 'S[ck]rip(t|t?c)ie', 'Digital anarchy')])->when(new MemberJoinedCommittee($id, $memberId))->then([new CommitteesList($id, 'S[ck]rip(t|t?c)ie', 'Digital anarchy', null, '', '', [['id' => '6bd3f9b9-b910-4d4c-89ea-2f9af285c9bf', 'first_name' => 'Mark', 'last_name' => 'Redeman']])])->when(new MemberLeftCommittee($id, $memberId))->then([new CommitteesList($id, 'S[ck]rip(t|t?c)ie', 'Digital anarchy', null, '', '', [])]); }
protected function createInstance() { return new CommitteesList(CommitteeId::generate(), 'S[ck]rip(t|t?c)ie', 'Digital anarchy'); }
/** * @test */ public function a_committee_has_members() { $id = CommitteeId::generate(); $memberId = MemberId::generate(); $this->scenario->withAggregateId($id)->given([new CommitteeInstantiated($id, 'S[ck]rip(t|t?c)ie', 'Digital anarchy')])->when(function ($committee) use($memberId) { $committee->joinByMember($memberId); })->then([new MemberJoinedCommittee($id, $memberId)])->when(function ($committee) use($memberId) { $committee->joinByMember($memberId); })->then([]); }
protected function createInstance() { return new CommitteeGoalChanged(CommitteeId::generate(), 'Websites bouwen'); }