mirror of
https://github.com/silverstripe/silverstripe-textextraction
synced 2024-10-22 11:06:00 +02:00
24 lines
659 B
PHP
24 lines
659 B
PHP
<?php
|
|
|
|
namespace SilverStripe\TextExtraction\Tests;
|
|
|
|
use SilverStripe\Assets\File;
|
|
use SilverStripe\Core\Config\Config;
|
|
use SilverStripe\Dev\SapphireTest;
|
|
use SilverStripe\TextExtraction\Cache\FileTextCache\Database;
|
|
|
|
class FileTextCacheDatabaseTest extends SapphireTest
|
|
{
|
|
public function testTruncatesByMaxLength()
|
|
{
|
|
Config::modify()->set(Database::class, 'max_content_length', 5);
|
|
|
|
$cache = new Database();
|
|
$file = $this->getMockBuilder(File::class)->setMethods(['write'])->getMock();
|
|
$content = '0123456789';
|
|
$cache->save($file, $content);
|
|
|
|
$this->assertEquals($cache->load($file), '01234');
|
|
}
|
|
}
|