mirror of
https://github.com/silverstripe/silverstripe-textextraction
synced 2024-10-22 11:06:00 +02:00
f341010d7a
- Added namespaces, use statements - Added missing docblocks etc - Uses SS4's new Cache system - Uses proper environment vars - Cannot instantiate 'FileTextCache' (interface) as a service. This can be configured through YML, so default to FileTextCache_Cache - Modded YML config to make it run. - Fixes to allow TIKA to actually get file contents. - Addresses issues raised by @robbieaverill - Rebased against github.com/silverstripe/silverstripe-textextraction:master - Replaced `SS_Log` with Monolog.
24 lines
688 B
PHP
24 lines
688 B
PHP
<?php
|
|
|
|
use SilverStripe\TextExtraction\Extension\FileTextCache,
|
|
SilverStripe\TextExtraction\Extension\FileTextCache_Database,
|
|
SilverStripe\Dev\SapphireTest,
|
|
SilverStripe\Core\Config\Config;
|
|
|
|
class FileTextCacheDatabaseTest extends SapphireTest
|
|
{
|
|
public function testTruncatesByMaxLength()
|
|
{
|
|
Config::nest();
|
|
|
|
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');
|
|
|
|
Config::unnest();
|
|
}
|
|
}
|