]> BookStack Code Mirror - bookstack/blobdiff - tests/Uploads/ImageTest.php
Fixed OIDC Logout
[bookstack] / tests / Uploads / ImageTest.php
index 55d08dad1068859041a7053202b3738d22a883c3..a9684eef72a9e52a55897571227ddf680f11daae 100644 (file)
@@ -104,11 +104,18 @@ class ImageTest extends TestCase
         $this->assertFileEquals($this->files->testFilePath('test-image.png'), public_path($relPath));
 
         $imageId = $imgDetails['response']->id;
+        $image = Image::findOrFail($imageId);
+        $image->updated_at = now()->subMonth();
+        $image->save();
+
         $this->call('PUT', "/images/{$imageId}/file", [], [], ['file' => $newUpload])
             ->assertOk();
 
         $this->assertFileEquals($this->files->testFilePath('compressed.png'), public_path($relPath));
 
+        $image->refresh();
+        $this->assertTrue($image->updated_at->gt(now()->subMinute()));
+
         $this->files->deleteAtRelativePath($relPath);
     }
 
@@ -532,15 +539,15 @@ class ImageTest extends TestCase
         $image = Image::first();
 
         $resp = $this->get("/images/edit/{$image->id}");
-        $this->withHtml($resp)->assertElementExists('button#image-manager-delete[title="Delete"]');
+        $this->withHtml($resp)->assertElementExists('button#image-manager-delete');
 
         $resp = $this->actingAs($viewer)->get("/images/edit/{$image->id}");
-        $this->withHtml($resp)->assertElementNotExists('button#image-manager-delete[title="Delete"]');
+        $this->withHtml($resp)->assertElementNotExists('button#image-manager-delete');
 
         $this->permissions->grantUserRolePermissions($viewer, ['image-delete-all']);
 
         $resp = $this->actingAs($viewer)->get("/images/edit/{$image->id}");
-        $this->withHtml($resp)->assertElementExists('button#image-manager-delete[title="Delete"]');
+        $this->withHtml($resp)->assertElementExists('button#image-manager-delete');
 
         $this->files->deleteAtRelativePath($relPath);
     }