@@ -459,72 +459,24 @@ public function testClearMetadataReturnsSelf(): void
459459 $ this ->assertSame ($ this ->handler , $ result );
460460 }
461461
462- public function testClearMetadataAll (): void
462+ public function testClearMetadata (): void
463463 {
464- $ this ->handler ->withFile ($ this ->path );
464+ $ this ->handler ->withFile ($ this ->origin . ' Steveston_dusk.JPG ' );
465465 /** @var Imagick $imagick */
466466 $ imagick = $ this ->handler ->getResource ();
467467 $ before = $ imagick ->getImageProperties ();
468- $ this ->assertGreaterThan (10 , $ before );
469-
470- $ this ->handler
471- ->clearMetadata ()
472- ->save ($ this ->root . 'ci-logo-no-metadata.png ' );
473-
474- $ this ->handler ->withFile ($ this ->root . 'ci-logo-no-metadata.png ' );
475- /** @var Imagick $imagick */
476- $ imagick = $ this ->handler ->getResource ();
477- $ after = $ imagick ->getImageProperties ();
478468
479- $ this ->assertLessThan (10 , count ($ after ));
480- }
481-
482- public function testClearMetadataExcept (): void
483- {
484- $ this ->handler ->withFile ($ this ->path );
485- /** @var Imagick $imagick */
486- $ imagick = $ this ->handler ->getResource ();
487- $ before = $ imagick ->getImageProperties ();
488- $ this ->assertArrayHasKey ('png:gAMA ' , $ before );
469+ $ this ->assertCount (44 , $ before );
489470
490- // Keep 2 properties
491471 $ this ->handler
492- ->clearMetadata (['except ' => ['png:bKGD ' , 'png:cHRM ' ]])
493- ->save ($ this ->root . 'ci-logo-no-metadata.png ' );
494-
495- $ this ->handler ->withFile ($ this ->root . 'ci-logo-no-metadata.png ' );
496- /** @var Imagick $imagick */
497- $ imagick = $ this ->handler ->getResource ();
498- $ after = $ imagick ->getImageProperties ();
499-
500- $ this ->assertArrayHasKey ('png:bKGD ' , $ after );
501- $ this ->assertArrayHasKey ('png:cHRM ' , $ after );
502- $ this ->assertArrayNotHasKey ('png:gAMA ' , $ after );
503- }
504-
505- public function testClearMetadataSpecific (): void
506- {
507- $ this ->handler ->withFile ($ this ->path );
508- /** @var Imagick $imagick */
509- $ imagick = $ this ->handler ->getResource ();
510- $ before = $ imagick ->getImageProperties ();
511-
512- $ this ->assertArrayHasKey ('png:bKGD ' , $ before );
513- $ this ->assertArrayHasKey ('png:cHRM ' , $ before );
514- $ this ->assertArrayHasKey ('png:gAMA ' , $ before );
515-
516- // Delete only 1
517- $ this ->handler
518- ->clearMetadata (['png:gAMA ' ])
519- ->save ($ this ->root . 'ci-logo-no-metadata.png ' );
472+ ->clearMetadata ()
473+ ->save ($ this ->root . 'exif-info-no-metadata.jpg ' );
520474
521- $ this ->handler ->withFile ($ this ->root . 'ci-logo -no-metadata.png ' );
475+ $ this ->handler ->withFile ($ this ->root . 'exif-info -no-metadata.jpg ' );
522476 /** @var Imagick $imagick */
523477 $ imagick = $ this ->handler ->getResource ();
524478 $ after = $ imagick ->getImageProperties ();
525479
526- $ this ->assertArrayHasKey ('png:bKGD ' , $ after );
527- $ this ->assertArrayHasKey ('png:cHRM ' , $ after );
528- $ this ->assertArrayNotHasKey ('png:gAMA ' , $ after );
480+ $ this ->assertCount (5 , $ after );
529481 }
530482}
0 commit comments