@@ -72,7 +72,9 @@ public function testCompressShouldNotCompressTwice() {
7272
7373 $ testmeta = $ this ->wp ->getTestMetadata ();
7474 $ meta = new Tiny_Metadata (1 , $ testmeta );
75+ $ meta ->add_request ();
7576 $ meta ->add_response (self ::successCompress ('vfs://root/wp-content/uploads/14/01/test.png ' ));
77+ $ meta ->add_request ('large ' );
7678 $ meta ->add_response (self ::successCompress ('vfs://root/wp-content/uploads/14/01/test-large.png ' ), 'large ' );
7779 $ meta ->update ();
7880
@@ -87,8 +89,11 @@ public function testCompressWhenFileChanged() {
8789
8890 $ testmeta = $ this ->wp ->getTestMetadata ();
8991 $ meta = new Tiny_Metadata (1 , $ testmeta );
92+ $ meta ->add_request ();
9093 $ meta ->add_response (self ::successCompress ('vfs://root/wp-content/uploads/14/01/test.png ' ));
94+ $ meta ->add_request ('large ' );
9195 $ meta ->add_response (self ::successCompress ('vfs://root/wp-content/uploads/14/01/test-large.png ' ), 'large ' );
96+ $ meta ->add_request ('post-thumbnail ' );
9297 $ meta ->add_response (self ::successCompress ('vfs://root/wp-content/uploads/14/01/test-post-thumbnail.png ' ), 'post-thumbnail ' );
9398 $ meta ->update ();
9499
@@ -110,8 +115,9 @@ public function testCompressShouldUpdateMetadata() {
110115
111116 $ metadata = $ this ->wp ->getMetadata (1 , 'tiny_compress_images ' , true );
112117 foreach ($ metadata as $ key => $ values ) {
113- $ this ->assertEquals (time (), $ values ['timestamp ' ], 2 );
114- unset($ metadata [$ key ]['timestamp ' ]);
118+ $ this ->assertEquals (time (), $ values ['end ' ], 2 );
119+ unset($ metadata [$ key ]['end ' ]);
120+ unset($ metadata [$ key ]['start ' ]);
115121 }
116122 $ this ->assertEquals (array (
117123 0 => array ('input ' => array ('size ' => 12345 ), 'output ' => array ('size ' => 10000 )),
@@ -178,6 +184,6 @@ public function testWrongMetadataShouldSaveTinyMetadata() {
178184 $ testmeta ['sizes ' ] = 0 ;
179185
180186 $ this ->subject ->compress_attachment ($ testmeta , 1 );
181- $ this ->assertEquals (1 , count ($ this ->wp ->getCalls ('update_post_meta ' )));
187+ $ this ->assertEquals (2 , count ($ this ->wp ->getCalls ('update_post_meta ' )));
182188 }
183189}
0 commit comments