‪TYPO3CMS  ‪main
VariableFrontendTest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
20 use PHPUnit\Framework\Attributes\DataProvider;
21 use PHPUnit\Framework\Attributes\Test;
24 use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
25 
26 final class ‪VariableFrontendTest extends FunctionalTestCase
27 {
29  'SYS' => [
30  'caching' => [
31  'cacheConfigurations' => [
32  // Set pages cache database backend, testing-framework sets this to NullBackend by default.
33  'pages' => [
34  'backend' => 'TYPO3\\CMS\\Core\\Cache\\Backend\\Typo3DatabaseBackend',
35  ],
36  ],
37  ],
38  ],
39  ];
40 
42  {
43  $arrayToSerialize = [
44  'string' => 'Serialize a string',
45  'integer' => 0,
46  'anotherIntegerValue' => 123456,
47  'float' => 12.34,
48  'bool' => true,
49  'array' => [
50  0 => 'test',
51  1 => 'another test',
52  ],
53  ];
54 
55  return [
56  [
57  $arrayToSerialize,
58  'pages',
59  $arrayToSerialize,
60  ],
61  ];
62  }
63 
64  #[DataProvider('insertSerializedArrayIntoLobAndRetrieveItDataProvider')]
65  #[Test]
67  array $expected,
68  string ‪$identifier,
69  array $arrayToSerialize
70  ): void {
71  $typo3DatabaseBackend = new ‪Typo3DatabaseBackend('Testing');
72  $subject = new ‪VariableFrontend(‪$identifier, $typo3DatabaseBackend);
73 
74  $subject->set('myIdentifier', $arrayToSerialize);
75  self::assertSame($expected, $subject->get('myIdentifier'));
76  }
77 }
‪TYPO3\CMS\Core\Tests\Functional\Cache\Frontend\VariableFrontendTest\$configurationToUseInTestInstance
‪array $configurationToUseInTestInstance
Definition: VariableFrontendTest.php:28
‪TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend
Definition: Typo3DatabaseBackend.php:30
‪TYPO3\CMS\Core\Tests\Functional\Cache\Frontend\VariableFrontendTest\insertSerializedArrayIntoLobAndRetrieveIt
‪insertSerializedArrayIntoLobAndRetrieveIt(array $expected, string $identifier, array $arrayToSerialize)
Definition: VariableFrontendTest.php:66
‪TYPO3\CMS\Core\Cache\Frontend\VariableFrontend
Definition: VariableFrontend.php:25
‪TYPO3\CMS\Core\Tests\Functional\Cache\Frontend\VariableFrontendTest\insertSerializedArrayIntoLobAndRetrieveItDataProvider
‪static insertSerializedArrayIntoLobAndRetrieveItDataProvider()
Definition: VariableFrontendTest.php:41
‪TYPO3\CMS\Core\Tests\Functional\Cache\Frontend
Definition: VariableFrontendTest.php:18
‪TYPO3\CMS\Webhooks\Message\$identifier
‪identifier readonly string $identifier
Definition: FileAddedMessage.php:37
‪TYPO3\CMS\Core\Tests\Functional\Cache\Frontend\VariableFrontendTest
Definition: VariableFrontendTest.php:27