File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -128,6 +128,11 @@ public function getMimeType(): string
128128 return 'text/plain ' ;
129129 }
130130
131+ public function getHash (): string
132+ {
133+ return md5_file ($ this ->getAbsolutePath ());
134+ }
135+
131136 /** @internal */
132137 public static function getCacheBustKey (string $ file ): string
133138 {
Original file line number Diff line number Diff line change @@ -336,4 +336,11 @@ public function testGetSiteMediaOutputDirectoryUsesConfiguredSiteOutputDirectory
336336 Hyde::setOutputDirectory (Hyde::path ('_site ' ));
337337 Hyde::setMediaDirectory ('_media ' );
338338 }
339+
340+ public function testGetHash ()
341+ {
342+ $ this ->file ('_media/foo.txt ' , 'Hello World! ' );
343+
344+ $ this ->assertSame (md5 ('Hello World! ' ), MediaFile::make ('foo.txt ' )->getHash ());
345+ }
339346}
You can’t perform that action at this time.
0 commit comments