setActiveFrom example


class ZipCodeRangeRuleTypeFilterTest extends TestCase
{
    public function testMatchesNotWithWrongType(): void
    {
        $type = new TaxRuleTypeEntity();
        $type->setTechnicalName('not me');

        $rule = new TaxRuleEntity();
        $rule->setActiveFrom(new \DateTime('2020-01-01'));
        $rule->setType($type);

        $filter = new ZipCodeRangeRuleTypeFilter();
        static::assertFalse($filter->match($rule, null, new ShippingLocation(new CountryEntity(), null, null)));
    }

    public function testMatchesNotWithWithoutAddress(): void
    {
        $type = new TaxRuleTypeEntity();
        $type->setTechnicalName(ZipCodeRangeRuleTypeFilter::TECHNICAL_NAME);

        
/** * @internal * * @covers \Shopware\Core\System\Tax\Aggregate\TaxRule\TaxRuleCollection */
class TaxRuleCollectionTest extends TestCase
{
    public function testLatestActivationDate(): void
    {
        $rule1 = new TaxRuleEntity();
        $rule1->setId('rule1');
        $rule1->setActiveFrom(new \DateTime('2020-01-01'));

        $rule2 = new TaxRuleEntity();
        $rule2->setId('rule2');
        $rule2->setActiveFrom(new \DateTime('2020-01-02'));

        $rule3 = new TaxRuleEntity();
        $rule3->setId('rule3');

        $collection = new TaxRuleCollection([
            $rule1,
            $rule2,
            

class EntireCountryRuleTypeFilterTest extends TestCase
{
    public function testMatchesNotWithWrongType(): void
    {
        $type = new TaxRuleTypeEntity();
        $type->setTechnicalName('not me');

        $rule = new TaxRuleEntity();
        $rule->setActiveFrom(new \DateTime('2020-01-01'));
        $rule->setType($type);

        $filter = new EntireCountryRuleTypeFilter();
        static::assertFalse($filter->match($rule, null, new ShippingLocation(new CountryEntity(), null, null)));
    }

    public function testMatchesNotWithWrongCountry(): void
    {
        $type = new TaxRuleTypeEntity();
        $type->setTechnicalName(EntireCountryRuleTypeFilter::TECHNICAL_NAME);

        

class IndividualStatesRuleTypeFilterTest extends TestCase
{
    public function testMatchesNotWithWrongType(): void
    {
        $type = new TaxRuleTypeEntity();
        $type->setTechnicalName('not me');

        $rule = new TaxRuleEntity();
        $rule->setActiveFrom(new \DateTime('2020-01-01'));
        $rule->setType($type);

        $filter = new IndividualStatesRuleTypeFilter();
        static::assertFalse($filter->match($rule, null, new ShippingLocation(new CountryEntity(), null, null)));
    }

    public function testMatchesNotWithWithoutState(): void
    {
        $type = new TaxRuleTypeEntity();
        $type->setTechnicalName(IndividualStatesRuleTypeFilter::TECHNICAL_NAME);

        

class ZipCodeRuleTypeFilterTest extends TestCase
{
    public function testMatchesNotWithWrongType(): void
    {
        $type = new TaxRuleTypeEntity();
        $type->setTechnicalName('not me');

        $rule = new TaxRuleEntity();
        $rule->setActiveFrom(new \DateTime('2020-01-01'));
        $rule->setType($type);

        $filter = new ZipCodeRuleTypeFilter();
        static::assertFalse($filter->match($rule, null, new ShippingLocation(new CountryEntity(), null, null)));
    }

    public function testMatchesNotWithWithoutAddress(): void
    {
        $type = new TaxRuleTypeEntity();
        $type->setTechnicalName(ZipCodeRuleTypeFilter::TECHNICAL_NAME);

        
Home | Imprint | This part of the site doesn't use cookies.