Ejemplo n.º 1
0
 /** @test */
 public function should_test_equality()
 {
     $one = ReminderId::fromString('d16f9fe7-e947-460e-99f6-2d64d65f46bc');
     $two = ReminderId::fromString('d16f9fe7-e947-460e-99f6-2d64d65f46bc');
     $three = ReminderId::generate();
     $this->assertTrue($one->equals($two));
     $this->assertFalse($one->equals($three));
 }
Ejemplo n.º 2
0
 /** @test */
 public function should_create_new_reminder_on_request()
 {
     $this->users->shouldReceive('userOfEmail')->once()->andReturn(true);
     $this->reminders->shouldReceive('deleteExistingRemindersForEmail')->once();
     $this->reminders->shouldReceive('nextIdentity')->once()->andReturn(ReminderId::generate());
     $this->reminders->shouldReceive('add')->once();
     $reminder = $this->service->request('*****@*****.**');
     $this->assertInstanceOf('Cribbb\\Domain\\Model\\Identity\\Reminder', $reminder);
 }
Ejemplo n.º 3
0
 public function setUp()
 {
     $this->id = ReminderId::generate();
     $this->email = new Email('*****@*****.**');
     $this->code = ReminderCode::generate();
     $this->timestamp = Carbon::create(2014, 10, 11, 10, 23, 34);
     Carbon::setTestNow($this->timestamp);
     $this->reminder = new Reminder($this->id, $this->email, $this->code);
 }
 /** @test */
 public function should_add_new_reminder()
 {
     $id = ReminderId::generate();
     $code = ReminderCode::fromNative('new');
     $email = new Email('*****@*****.**');
     $reminder = new Reminder($id, $email, $code);
     $this->repository->add($reminder);
     $this->em->clear();
     $reminder = $this->repository->findReminderByEmailAndCode($email, $code);
     $this->assertInstanceOf('Cribbb\\Domain\\Model\\Identity\\Reminder', $reminder);
     $this->assertEquals($code, $reminder->code());
     $this->assertEquals($email, $reminder->email());
 }
Ejemplo n.º 5
0
 /**
  * Load the User fixtures
  *
  * @param ObjectManager $manager
  * @return void
  */
 public function load(ObjectManager $manager)
 {
     // Create valid Reminder
     $id = ReminderId::generate();
     $email = new Email('*****@*****.**');
     $code = ReminderCode::fromNative('code+99');
     $reminder = new Reminder($id, $email, $code);
     $manager->persist($reminder);
     // Create expired Reminder
     Carbon::setTestNow(Carbon::create(2014, 10, 11, 10, 23, 34));
     $id = ReminderId::generate();
     $email = new Email('*****@*****.**');
     $code = ReminderCode::fromNative('code+1');
     $reminder = new Reminder($id, $email, $code);
     Carbon::setTestNow();
     $manager->persist($reminder);
     $manager->flush();
 }
 /**
  * Return the next identity
  *
  * @return ReminderId
  */
 public function nextIdentity()
 {
     return ReminderId::generate();
 }