laravel-at /
laravel-image-sanitize
| 1 | <?php |
||
| 2 | |||
| 3 | namespace LaravelAt\ImageSanitize\Tests; |
||
| 4 | |||
| 5 | use LaravelAt\ImageSanitize\ImageSanitize; |
||
| 6 | |||
| 7 | class ImageSanitizeTest extends TestCase |
||
| 8 | { |
||
| 9 | /** @test */ |
||
| 10 | public function it_detects_embedded_malicious_code() |
||
| 11 | { |
||
| 12 | $content = file_get_contents(__DIR__.'/stubs/exploit.jpeg'); |
||
| 13 | |||
| 14 | $this->assertTrue( |
||
| 15 | $this->app->make(ImageSanitize::class)->detect($content) |
||
|
0 ignored issues
–
show
|
|||
| 16 | ); |
||
| 17 | } |
||
| 18 | |||
| 19 | /** @test */ |
||
| 20 | public function it_removes_malicious_code() |
||
| 21 | { |
||
| 22 | $content = file_get_contents(__DIR__.'/stubs/exploit.jpeg'); |
||
| 23 | |||
| 24 | $secureImage = $this->app->make(ImageSanitize::class)->sanitize($content); |
||
| 25 | |||
| 26 | $this->assertFalse($this->app->make(ImageSanitize::class)->detect($secureImage)); |
||
| 27 | } |
||
| 28 | } |
||
| 29 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.