forked from libvips/php-vips
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExceptionTest.php
69 lines (53 loc) · 1.44 KB
/
ExceptionTest.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
69
<?php
namespace Jcupitt\Vips\Test;
use Jcupitt\Vips;
use PHPUnit\Framework\TestCase;
class ExceptionTest extends TestCase
{
/**
* @var Vips\Image
*/
private $image;
protected function setUp(): void
{
$filename = __DIR__ . '/images/img_0076.jpg';
$this->image = Vips\Image::newFromFile($filename);
}
protected function tearDown(): void
{
unset($this->image);
}
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
*/