CommerceGuys\Zone\Model\ZoneMemberZone::setZone PHP Method

setZone() public method

Sets the zone.
public setZone ( CommerceGuys\Zone\Model\ZoneEntityInterface $zone ) : self
$zone CommerceGuys\Zone\Model\ZoneEntityInterface The zone matched by the zone member.
return self
    public function setZone(ZoneEntityInterface $zone)
    {
        $this->zone = $zone;
        return $this;
    }

Usage Example

Example #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));
 }
All Usage Examples Of CommerceGuys\Zone\Model\ZoneMemberZone::setZone