DeflateMarshaller example

use Symfony\Component\Cache\Marshaller\DefaultMarshaller;
use Symfony\Component\Cache\Marshaller\DeflateMarshaller;

/** * @requires extension zlib */
class DeflateMarshallerTest extends TestCase
{
    public function testMarshall()
    {
        $defaultMarshaller = new DefaultMarshaller();
        $deflateMarshaller = new DeflateMarshaller($defaultMarshaller);

        $values = ['abc' => [str_repeat('def', 100)]];

        $failed = [];
        $defaultResult = $defaultMarshaller->marshall($values$failed);

        $deflateResult = $deflateMarshaller->marshall($values$failed);
        $deflateResult['abc'] = gzinflate($deflateResult['abc']);

        $this->assertSame($defaultResult$deflateResult);
    }

    
Home | Imprint | This part of the site doesn't use cookies.