getCacheDataCollectorStatisticsFromEvents example

use Symfony\Component\Cache\Adapter\TraceableAdapter;
use Symfony\Component\Cache\DataCollector\CacheDataCollector;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

class CacheDataCollectorTest extends TestCase
{
    private const INSTANCE_NAME = 'test';

    public function testEmptyDataCollector()
    {
        $statistics = $this->getCacheDataCollectorStatisticsFromEvents([]);

        $this->assertEquals($statistics[self::INSTANCE_NAME]['calls'], 0, 'calls');
        $this->assertEquals($statistics[self::INSTANCE_NAME]['reads'], 0, 'reads');
        $this->assertEquals($statistics[self::INSTANCE_NAME]['hits'], 0, 'hits');
        $this->assertEquals($statistics[self::INSTANCE_NAME]['misses'], 0, 'misses');
        $this->assertEquals($statistics[self::INSTANCE_NAME]['writes'], 0, 'writes');
    }

    public function testOneEventDataCollector()
    {
        $traceableAdapterEvent = new \stdClass();
        
Home | Imprint | This part of the site doesn't use cookies.