CommerceGuys\Tax\Tests\Resolver\EuTaxTypeResolverTest::getContext PHP Method

getContext() protected method

Returns a mock context based on the provided data.
protected getContext ( CommerceGuys\Addressing\AddressInterface $customerAddress, CommerceGuys\Addressing\AddressInterface $storeAddress, string $customerTaxNumber = '', array $storeRegistrations = [], DateTime $date = null ) : Context
$customerAddress CommerceGuys\Addressing\AddressInterface The customer address.
$storeAddress CommerceGuys\Addressing\AddressInterface The store address.
$customerTaxNumber string The customer tax number.
$storeRegistrations array The store registrations.
$date DateTime The date.
return CommerceGuys\Tax\Resolver\Context
    protected function getContext($customerAddress, $storeAddress, $customerTaxNumber = '', $storeRegistrations = [], $date = null)
    {
        $context = $this->getMockBuilder('CommerceGuys\\Tax\\Resolver\\Context')->disableOriginalConstructor()->getMock();
        $context->expects($this->any())->method('getCustomerAddress')->will($this->returnValue($customerAddress));
        $context->expects($this->any())->method('getStoreAddress')->will($this->returnValue($storeAddress));
        $context->expects($this->any())->method('getCustomerTaxNumber')->will($this->returnValue($customerTaxNumber));
        $context->expects($this->any())->method('getStoreRegistrations')->will($this->returnValue($storeRegistrations));
        $date = $date ?: new \DateTime();
        $context->expects($this->any())->method('getDate')->will($this->returnValue($date));
        return $context;
    }