Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
RhysLees committed Dec 7, 2023
1 parent 010d144 commit 0fdc99a
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/DocuWareSearchRequestBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,16 @@ public function filter(string $name, mixed $value): self
return $this;
}

public function filterIn(string $name, mixed $values): self
{
$builder = $this;
foreach ($values as $value) {
$builder = $builder->filter($name, $value);
}

return $builder;
}

/**
* @throws \ReflectionException
* @throws InvalidResponseClassException
Expand Down
23 changes: 23 additions & 0 deletions tests/Feature/Requests/Search/GetSearchRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,3 +221,26 @@
$this->assertInstanceOf(DocumentPaginator::class, $paginator);
Event::assertDispatched(DocuWareResponseLog::class);
})->group('search');


it('can search documents with multiple values', function () {
Event::fake();

$fileCabinetIds = [
config('laravel-docuware.tests.file_cabinet_id'),
];

$paginatorRequest = (new DocuWare())
->searchRequestBuilder()
->fileCabinets($fileCabinetIds)
->page(null)
->perPage(null)
->fulltext(null)
->filterIn('DOCUMENT_TYPE', ['Abrechnung', 'Rechnung'])
->get();

$paginator = $this->connector->send($paginatorRequest)->dto();

$this->assertInstanceOf(DocumentPaginator::class, $paginator);
Event::assertDispatched(DocuWareResponseLog::class);
})->group('search');

0 comments on commit 0fdc99a

Please sign in to comment.