Get FilterTest passing again for now

This commit is contained in:
Oliver Davies 2019-05-03 22:09:50 +01:00
parent 5d5d5118ef
commit 21a6f431db
2 changed files with 12 additions and 2 deletions

View file

@ -274,7 +274,17 @@ class Filter
*/
public function toArray(): array
{
return $this->properties;
return collect($this->properties)->merge(
$this->conditions->flatten(1)->mapWithKeys(function (FilterCondition $condition) {
$values = $condition->getValues();
return [
$condition->getProperty() => $values->count() == 1
? $values->first()
: $values
];
})
)->toArray();
}
public function getConditions(): Collection

View file

@ -358,7 +358,7 @@ class FilterTest extends TestCase
'shouldStar' => 'true',
'shouldAlwaysMarkAsImportant' => 'true',
],
$this->filter->from(['foo@example.com ', 'bar@example.com'])
$this->filter->from(['foo@example.com', 'bar@example.com'])
->has('Something')
->excludeChats()
->labelAndArchive('Foo')