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));
 }