forked from Intervention/image
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIptcCommandTest.php
More file actions
72 lines (63 loc) · 2.26 KB
/
IptcCommandTest.php
File metadata and controls
72 lines (63 loc) · 2.26 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php
use Intervention\Image\Commands\IptcCommand;
use PHPUnit\Framework\TestCase;
class IptcCommandTest extends TestCase
{
public function tearDown()
{
Mockery::close();
}
public function testFetchAll()
{
$image = Mockery::mock('Intervention\Image\Image');
$image->dirname = __DIR__.'/images';
$image->basename = 'iptc.jpg';
$command = new IptcCommand([]);
$result = $command->execute($image);
$this->assertTrue($result);
$this->assertTrue($command->hasOutput());
$this->assertInternalType('array', $command->getOutput());
}
public function testFetchDefined()
{
$image = Mockery::mock('Intervention\Image\Image');
$image->dirname = __DIR__.'/images';
$image->basename = 'exif.jpg';
$command = new IptcCommand(['AuthorByline']);
$result = $command->execute($image);
$this->assertTrue($result);
$this->assertTrue($command->hasOutput());
$this->assertEquals('Oliver Vogel', $command->getOutput());
}
public function testFetchNonExisting()
{
$image = Mockery::mock('Intervention\Image\Image');
$image->dirname = __DIR__.'/images';
$image->basename = 'exif.jpg';
$command = new IptcCommand(['xxx']);
$result = $command->execute($image);
$this->assertTrue($result);
$this->assertTrue($command->hasOutput());
$this->assertEquals(null, $command->getOutput());
}
public function testFetchFromPng()
{
$image = Mockery::mock('Intervention\Image\Image');
$image->dirname = __DIR__.'/images';
$image->basename = 'star.png';
$command = new IptcCommand(['Orientation']);
$result = $command->execute($image);
$this->assertTrue($result);
$this->assertTrue($command->hasOutput());
$this->assertEquals(null, $command->getOutput());
}
public function testReturnNullOnIptcReadFail()
{
$image = Mockery::mock('Intervention\Image\Image');
$command = new IptcCommand(['Orientation']);
$result = $command->execute($image);
$this->assertTrue($result);
$this->assertTrue($command->hasOutput());
$this->assertEquals(null, $command->getOutput());
}
}