-
Notifications
You must be signed in to change notification settings - Fork 250
Expand file tree
/
Copy pathBase64ProcessorTest.php
More file actions
45 lines (41 loc) · 1.67 KB
/
Copy pathBase64ProcessorTest.php
File metadata and controls
45 lines (41 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
namespace Josegonzalez\Upload\Test\TestCase\File\Path;
use Cake\TestSuite\TestCase;
use Josegonzalez\Upload\File\Path\Base64Processor;
class Base64ProcessorTest extends TestCase
{
public function testIsProcessorInterface()
{
$entity = $this->getMockBuilder('Cake\ORM\Entity')->getMock();
$table = $this->getMockBuilder('Cake\ORM\Table')->getMock();
$data = ['name' => 'filename'];
$field = 'field';
$settings = [];
$processor = new Base64Processor($table, $entity, $data, $field, $settings);
$this->assertInstanceOf('Josegonzalez\Upload\File\Path\ProcessorInterface', $processor);
}
public function testRandomFileNameDefaultExtension()
{
$entity = $this->getMockBuilder('Cake\ORM\Entity')->getMock();
$table = $this->getMockBuilder('Cake\ORM\Table')->getMock();
$data = ['name' => 'filename'];
$field = 'field';
$settings = [];
$processor = new Base64Processor($table, $entity, $data, $field, $settings);
$fileName = $processor->filename();
$found = strpos($fileName, '.png');
$this->assertNotFalse($found);
}
public function testRandomFileNameCustomExtension()
{
$entity = $this->getMockBuilder('Cake\ORM\Entity')->getMock();
$table = $this->getMockBuilder('Cake\ORM\Table')->getMock();
$data = ['name' => 'filename'];
$field = 'field';
$settings = ['base64_extension' => '.cake'];
$processor = new Base64Processor($table, $entity, $data, $field, $settings);
$fileName = $processor->filename();
$found = strpos($fileName, '.cake');
$this->assertNotFalse($found);
}
}