This commit is contained in:
Oliver Davies 2019-04-10 23:12:03 +01:00
parent 09cf724f70
commit 3941c5abd7
4 changed files with 68 additions and 12 deletions

View file

@ -89,20 +89,16 @@ class OtherwiseHasTest extends TestCase
->trash()
)->otherwise(
Filter::create()
->has('to:me@example.com subject:Baz')
->has('to:me@example.com')
->trash()
);
$this->assertSame('subject:Foo', $filters->all()->get(0)->getConditions()->get(1));
$expected = [
['to:me@example.com', 'subject:Foo'],
['to:me@example.com', '!subject:Foo', 'subject:Bar'],
['to:me@example.com', '!subject:Foo', '!subject:Bar'],
];
// The subject condition from the first filter should be present but
// negated.
$this->assertSame('!subject:Foo', $filters->all()->get(1)->getConditions()->get(1));
// Both subject conditions from both previous filters should be present
// but negated.
// $this->assertSame('!subject:[Foo|Bar]', $filters->all()->get(2)->getConditions()->get(1));
$this->assertSame('!subject:Foo', $filters->all()->get(2)->getConditions()->get(1));
$this->assertSame('!subject:Bar', $filters->all()->get(2)->getConditions()->get(2));
$this->assertSame($expected, $filters->getUpdatedConditions()->toArray());
}
}