示例#1
0
 public function testIdentifiedVisitorsAreComparedByEmail()
 {
     $identified_visitor_1 = new IdentifiedVisitor('John Doe', '*****@*****.**');
     $identified_visitor_2 = new IdentifiedVisitor('', '*****@*****.**');
     $this->assertTrue($identified_visitor_1->is($identified_visitor_2));
     $this->assertTrue($identified_visitor_2->is($identified_visitor_1));
 }
示例#2
0
 public function testNameFormWhenLastNameIsMissing()
 {
     $bill = new IdentifiedVisitor('', '*****@*****.**');
     $this->assertEquals('Bill', $bill->formatName());
     $this->assertEquals('Bill', $bill->formatName(UserInterface::NAME_SHORT_LAST_NAME));
     $this->assertEquals('B.', $bill->formatName(UserInterface::NAME_SHORT_FIRST_NAME));
     $this->assertEquals('B', $bill->formatName(UserInterface::NAME_INITIALS));
 }
 /**
  * Test if first name is extracted from personal bit of email address, when available.
  */
 public function testPersonalBitOfEmailIsUsedWhenFullNameIsNotProvided()
 {
     $bill = new IdentifiedVisitor('', '*****@*****.**');
     $this->assertEquals('Bill', $bill->getFirstName());
     $this->assertEquals('Gates', $bill->getLastName());
     $steve = new IdentifiedVisitor('', '*****@*****.**');
     $this->assertEquals('Steve', $steve->getFirstName());
     $this->assertEquals('', $steve->getLastName());
 }