CommerceGuys\Zone\Tests\Model\ZoneMemberZoneTest::testMatch PHP Method

testMatch() public method

public testMatch ( )
    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));
    }