match() публичный Метод

public match ( CommerceGuys\Addressing\AddressInterface $address )
$address CommerceGuys\Addressing\AddressInterface
Пример #1
0
 /**
  * @covers ::match
  *
  * @uses \CommerceGuys\Zone\Model\ZoneMemberZone::setZone
  */
 public function testMatch()
 {
     $address = $this->getMockBuilder('CommerceGuys\\Addressing\\Address')->disableOriginalConstructor()->getMock();
     $matchingZone = $this->getMockBuilder('CommerceGuys\\Zone\\Model\\Zone')->disableOriginalConstructor()->getMock();
     $matchingZone->expects($this->any())->method('match')->with($address)->will($this->returnValue(true));
     $nonMatchingZone = $this->getMockBuilder('CommerceGuys\\Zone\\Model\\Zone')->disableOriginalConstructor()->getMock();
     $nonMatchingZone->expects($this->any())->method('match')->with($address)->will($this->returnValue(false));
     $this->zoneMember->setZone($matchingZone);
     $this->assertEquals(true, $this->zoneMember->match($address));
     $this->zoneMember->setZone($nonMatchingZone);
     $this->assertEquals(false, $this->zoneMember->match($address));
 }