Skip to content
Snippets Groups Projects
Commit 6752a362 authored by Manuel Selbach's avatar Manuel Selbach Committed by Andreas Fernandez
Browse files

[TASK] Functional test for VariableFrontend cache type

Add a functional test to verify that serialized PHP objects
can be successfully stored in the database without having
encoding/escaping problems.

Resolves: #79452
Releases: master
Change-Id: I97d586cb8a50e571d99ff8b7fc463c0a83e15f36
Reviewed-on: https://review.typo3.org/51394


Reviewed-by: default avatarMorton Jonuschat <m.jonuschat@mojocode.de>
Tested-by: default avatarMorton Jonuschat <m.jonuschat@mojocode.de>
Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: default avatarManuel Selbach <manuel_selbach@yahoo.de>
Tested-by: default avatarManuel Selbach <manuel_selbach@yahoo.de>
Reviewed-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: default avatarAndreas Fernandez <typo3@scripting-base.de>
Tested-by: default avatarAndreas Fernandez <typo3@scripting-base.de>
parent 87b78a63
No related merge requests found
<?php
namespace TYPO3\CMS\Core\Tests\Functional\Cache\Frontend;
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
use TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend;
use TYPO3\CMS\Core\Cache\Frontend\VariableFrontend;
/**
* Test case
*/
class VariableFrontendTest extends \TYPO3\CMS\Components\TestingFramework\Core\FunctionalTestCase
{
public function insertSerializedArrayIntoLobAndRetrieveItDataProvider()
{
$arrayToSerialize = [
'string' => 'Serialize a string',
'integer' => 0,
'anotherIntegerValue' => 123456,
'float' => 12.34,
'bool' => true,
'array' => [
0 => 'test',
1 => 'another test',
],
];
return [
[
$arrayToSerialize,
'cache_pages',
$arrayToSerialize,
]
];
}
/**
* @dataProvider insertSerializedArrayIntoLobAndRetrieveItDataProvider
*
* @test
*
* @param array $expected
* @param string $identifier
* @param array $arrayToSerialize
*/
public function insertSerializedArrayIntoLobAndRetrieveIt(
array $expected,
string $identifier,
array $arrayToSerialize
) {
$typo3DatabaseBackend = new Typo3DatabaseBackend('Testing');
$subject = new VariableFrontend($identifier, $typo3DatabaseBackend);
$subject->set('myIdentifier', $arrayToSerialize);
$this->assertSame($expected, $subject->get('myIdentifier'));
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment