@@ -436,4 +436,69 @@ public function testGetCachedScriptsZeroedTimestamp()
436436
437437 $ this ->assertSame ([], $ status ->getCachedScripts ());
438438 }
439+
440+ /**
441+ * @covers OpCacheGUI\OpCache\Status::__construct
442+ * @covers OpCacheGUI\OpCache\Status::getCachedScriptsForOverview
443+ * @covers OpCacheGUI\OpCache\Status::getCachedScripts
444+ * @covers OpCacheGUI\OpCache\Status::sortCachedScripts
445+ */
446+ public function testGetCachedScriptsForOverviewFilled ()
447+ {
448+ $ formatter = $ this ->getMock ('\\OpCacheGUI \\Format \\Byte ' );
449+ $ formatter ->method ('format ' )->will ($ this ->onConsecutiveCalls ('1KB ' , '2KB ' , '3KB ' , '4KB ' , '5KB ' , '6KB ' ));
450+
451+ $ status = new Status ($ formatter , $ this ->getMock ('\\OpCacheGUI \\I18n \\Translator ' ), $ this ->statusData );
452+
453+ $ data = [
454+ [
455+ 'full_path ' => '/var/www/vhosts/NoTimeStamp/src/Psr/Autoloader.php ' ,
456+ 'hits ' => 12876 ,
457+ 'memory_consumption ' => '6KB ' ,
458+ 'last_used_timestamp ' => '14:25:15 09-10-2014 ' ,
459+ 'timestamp ' => 'N/A ' ,
460+ ],
461+ [
462+ 'full_path ' => '/var/www/vhosts/OpcacheGUI/src/OpCacheGUI/Network/Request.php ' ,
463+ 'hits ' => 1 ,
464+ 'memory_consumption ' => '1KB ' ,
465+ 'last_used_timestamp ' => '14:08:35 09-10-2014 ' ,
466+ 'timestamp ' => '16:20:53 07-10-2014 ' ,
467+ ],
468+ [
469+ 'full_path ' => '/var/www/vhosts/OpcacheGUI/template/cached.phtml ' ,
470+ 'hits ' => 4 ,
471+ 'memory_consumption ' => '2KB ' ,
472+ 'last_used_timestamp ' => '14:08:35 09-10-2014 ' ,
473+ 'timestamp ' => '16:20:53 07-10-2014 ' ,
474+ ],
475+ [
476+ 'full_path ' => '/var/www/vhosts/RedTube/template/humiliation/germany-vs-brazil.phtml ' ,
477+ 'hits ' => 71 ,
478+ 'memory_consumption ' => '4KB ' ,
479+ 'last_used_timestamp ' => '14:25:15 09-10-2014 ' ,
480+ 'timestamp ' => '20:01:15 08-10-2014 ' ,
481+ ],
482+ [
483+ 'full_path ' => '/var/www/vhosts/SomeOtherProject/src/Foo.php ' ,
484+ 'hits ' => 19 ,
485+ 'memory_consumption ' => '3KB ' ,
486+ 'last_used_timestamp ' => '15:31:55 09-10-2014 ' ,
487+ 'timestamp ' => '20:07:33 08-10-2014 ' ,
488+ ],
489+ [
490+ 'full_path ' => '/var/www/vhosts/SomeOtherProject/src/Psr/Autoloader.php ' ,
491+ 'hits ' => 32 ,
492+ 'memory_consumption ' => '5KB ' ,
493+ 'last_used_timestamp ' => '14:25:15 09-10-2014 ' ,
494+ 'timestamp ' => '20:01:15 08-10-2014 ' ,
495+ ],
496+ ];
497+
498+ $ trimmer = $ this ->getMock ('\\OpCacheGUI \\Format \\Trimmer ' );
499+ $ trimmer ->method ('trim ' )->will ($ this ->returnArgument (0 ));
500+
501+ $ this ->assertSame ($ data , $ status ->getCachedScriptsForOverview ($ trimmer ));
502+ }
503+
439504}
0 commit comments