-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathexception.php
68 lines (52 loc) · 1.46 KB
/
exception.php
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
<?php
use Jcupitt\Vips;
class VipsExceptionTest extends PHPUnit\Framework\TestCase
{
/**
* @var Vips\Image
*/
private $image;
/**
* The original value of pixel (0, 0).
*/
private $pixel;
protected function setUp()
{
$filename = dirname(__FILE__) . '/images/img_0076.jpg';
$this->image = Vips\Image::newFromFile($filename);
$this->pixel = $this->image->getpoint(0, 0);
}
public function testVipsNewFromFileException()
{
$this->expectException(Vips\Exception::class);
$image = Vips\Image::newFromFile("I don't exist.jpg");
}
public function testVipsWriteToFileException()
{
$this->expectException(Vips\Exception::class);
$this->image->writeToFile("/directory/doesn't/exist.jpg");
}
public function testVipsWriteToBufferException()
{
$this->expectException(Vips\Exception::class);
$string = $this->image->writeToBuffer('.jpg', ['crazy option' => 42]);
}
public function testVipsGetException()
{
$this->expectException(Vips\Exception::class);
$x = $this->image->get("I don't exist");
}
public function testVipsOperationException()
{
$this->expectException(Vips\Exception::class);
$x = $this->image->add([1, 2, 3, 4]);
}
}
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: expandtab sw=4 ts=4 fdm=marker
* vim<600: expandtab sw=4 ts=4
*/