2015-05-07 09:14:02 +02:00
|
|
|
<?php
|
2017-12-20 22:24:39 +01:00
|
|
|
|
|
|
|
use SilverStripe\TextExtraction\Extension\FileTextCache,
|
|
|
|
SilverStripe\TextExtraction\Extension\FileTextCache_Database,
|
|
|
|
SilverStripe\Dev\SapphireTest,
|
|
|
|
SilverStripe\Core\Config\Config;
|
|
|
|
|
2015-11-18 05:07:31 +01:00
|
|
|
class FileTextCacheDatabaseTest extends SapphireTest
|
|
|
|
{
|
|
|
|
public function testTruncatesByMaxLength()
|
|
|
|
{
|
|
|
|
Config::nest();
|
2017-12-20 22:24:39 +01:00
|
|
|
|
2015-11-18 05:07:31 +01:00
|
|
|
Config::inst()->update('FileTextCache_Database', 'max_content_length', 5);
|
|
|
|
$cache = new FileTextCache_Database();
|
|
|
|
$file = $this->getMock('File', array('write'));
|
|
|
|
$content = '0123456789';
|
|
|
|
$cache->save($file, $content);
|
|
|
|
$this->assertEquals($cache->load($file), '01234');
|
2015-05-07 09:14:02 +02:00
|
|
|
|
2015-11-18 05:07:31 +01:00
|
|
|
Config::unnest();
|
|
|
|
}
|
|
|
|
}
|