get(BuiltinAttachmentsFinder::class); } public function dataProvider() { return [ //No value should return empty array ['', [], []], ['', ['empty_returns_all' => true], static::$mock_list], //Basic search for keyword ['test', [], ['%FOOTPRINTS%/test/test.jpg', '%FOOTPRINTS%/test/test.png', '%FOOTPRINTS_3D%/test.jpg']], ['%FOOTPRINTS_3D%', [], ['%FOOTPRINTS_3D%/test.jpg', '%FOOTPRINTS_3D%/hallo.txt']], ['.txt', [], ['%FOOTPRINTS_3D%/hallo.txt']], //Filter extensions //['test', ['allowed_extensions' => ['jpeg', 'jpg']], ['%FOOTPRINTS%/test/test.jpg', '%FOOTPRINTS%/123.jpeg', '%FOOTPRINTS_3D%/test.jpg']], //['test.jpg', ['allowed_extensions' => ['jpeg', 'jpg']], ['%FOOTPRINTS%/test/test.jpg', '%FOOTPRINTS_3D%/test.jpg']] ]; } /** * @dataProvider dataProvider */ public function testFind($keyword, $options, $expected): void { $value = static::$service->find($keyword, $options, static::$mock_list); //$this->assertEquals($expected, static::$service->find($keyword, $options, static::$mock_list)); $this->assertSame([], array_diff($value, $expected), 'Additional'); $this->assertSame([], array_diff($expected, $value), 'Missing:'); } }