Пример #1
0
 public function testPassBeacon()
 {
     $this->assertPasses($this->pass, PassValidator::BEACON_PROXIMITY_UUID_REQUIRED);
     $this->assertPasses($this->pass, PassValidator::BEACON_MAJOR_INVALID);
     $this->assertPasses($this->pass, PassValidator::BEACON_MINOR_INVALID);
     $beacon = new Beacon('2b4fcf51-4eaa-446d-b24e-4d1b437f3840');
     $this->pass->addBeacon($beacon);
     $this->assertPasses($this->pass, PassValidator::BEACON_PROXIMITY_UUID_REQUIRED);
     $this->assertPasses($this->pass, PassValidator::BEACON_MAJOR_INVALID);
     $this->assertPasses($this->pass, PassValidator::BEACON_MINOR_INVALID);
     $beacon->setMajor('');
     $this->assertFails($this->pass, PassValidator::BEACON_MAJOR_INVALID);
     $beacon->setMajor('foo');
     $this->assertFails($this->pass, PassValidator::BEACON_MAJOR_INVALID);
     $beacon->setMajor(-1);
     $this->assertFails($this->pass, PassValidator::BEACON_MAJOR_INVALID);
     $beacon->setMajor(65536);
     $this->assertFails($this->pass, PassValidator::BEACON_MAJOR_INVALID);
     $beacon->setMajor(0);
     $beacon->setMinor('');
     $this->assertFails($this->pass, PassValidator::BEACON_MINOR_INVALID);
     $beacon->setMinor('foo');
     $this->assertFails($this->pass, PassValidator::BEACON_MINOR_INVALID);
     $beacon->setMinor(-1);
     $this->assertFails($this->pass, PassValidator::BEACON_MINOR_INVALID);
     $beacon->setMinor(65536);
     $this->assertFails($this->pass, PassValidator::BEACON_MINOR_INVALID);
 }