mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Fix test cases.
This commit is contained in:
@@ -1230,17 +1230,20 @@ class BinderTest extends TestCase
|
||||
*/
|
||||
public function testTagList()
|
||||
{
|
||||
$tagRepos = $this->mock(TagRepositoryInterface::class);
|
||||
$tagRepos->shouldReceive('setUser');
|
||||
$tags = $this->user()->tags()->whereIn('id', [1, 2])->get(['tags.*']);
|
||||
$tagRepos->shouldReceive('get')->once()->andReturn($tags);
|
||||
|
||||
Route::middleware(Binder::class)->any(
|
||||
'/_test/binder/{tagList}', function (Collection $tags) {
|
||||
return 'count: ' . $tags->count();
|
||||
}
|
||||
);
|
||||
$tags = $this->user()->tags()->whereIn('id', [1, 2])->get(['tags.*']);
|
||||
|
||||
$names = join(',', $tags->pluck('tag')->toArray());
|
||||
|
||||
$repository = $this->mock(TagRepositoryInterface::class);
|
||||
$repository->shouldReceive('setUser');
|
||||
$repository->shouldReceive('get')->once()->andReturn($tags);
|
||||
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->get('/_test/binder/' . $names);
|
||||
@@ -1256,6 +1259,10 @@ class BinderTest extends TestCase
|
||||
*/
|
||||
public function testTagListEmpty()
|
||||
{
|
||||
$tagRepos = $this->mock(TagRepositoryInterface::class);
|
||||
$tagRepos->shouldReceive('setUser');
|
||||
$tagRepos->shouldReceive('get')->once()->andReturn(new Collection());
|
||||
|
||||
Route::middleware(Binder::class)->any(
|
||||
'/_test/binder/{tagList}', function (Collection $tags) {
|
||||
return 'count: ' . $tags->count();
|
||||
|
||||
Reference in New Issue
Block a user