mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-08-30 20:18:00 +00:00
40911aa104
Many problems with Dependabot this month. Phpstan introduced a lot of new "errors". These are now fixed or annotated. I combined this with a change to require comments for `phpstan-ignore`. These won't always be useful, but I think requiring them makes sense. Tcpdf is more of a non-update. Our composer.json specified `^6.5`. For some reason, Dependabot decided it was okay to change that to `^6.5||^7.0`, which seems presumptuous. (One of the triggers was probably the elimination of Php8.1, since the new product requires 8.2+.) Tcpdf is nominally deprecated, replaced by tc-lib-pdf. Tcpdf 7 passes control to the new product. However, the upgrade is not straightforward. The user needs to supply font files which were formerly distributed with the product, and a code change to define a (shudder) global constant is required. Consequently, Dependabot's upgrade failed its unit tests. While I may evaluate what might be needed at some point in the future, for now I am just updating composer.json to reject Tcpdf 7+.
41 lines
1.2 KiB
PHP
41 lines
1.2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace PhpOffice\PhpSpreadsheetTests;
|
|
|
|
use PhpOffice\PhpSpreadsheet\Exception as SpException;
|
|
use PhpOffice\PhpSpreadsheet\Settings;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class SettingsTest extends TestCase
|
|
{
|
|
protected function tearDown(): void
|
|
{
|
|
Settings::setCache(null);
|
|
}
|
|
|
|
public function testInvalidChartRenderer(): void
|
|
{
|
|
$this->expectException(SpException::class);
|
|
$this->expectExceptionMessage('Chart renderer must implement');
|
|
Settings::setChartRenderer(self::class); // @phpstan-ignore argument.type (deliberate run-time test)
|
|
}
|
|
|
|
public function testCache(): void
|
|
{
|
|
$cache1 = Settings::getCache();
|
|
Settings::setCache(null);
|
|
$cache2 = Settings::getCache();
|
|
self::assertEquals($cache1, $cache2);
|
|
self::assertNotSame($cache1, $cache2);
|
|
$array = ['A1' => 10, 'B2' => 20];
|
|
$cache2->setMultiple($array);
|
|
self::assertSame($array, $cache2->getMultiple(array_keys($array)));
|
|
self::assertNull($cache2->get('C3'));
|
|
$cache2->clear();
|
|
self::assertNull($cache2->get('A1'));
|
|
self::assertNull($cache2->get('B2'));
|
|
}
|
|
}
|