Passed
Branch 2.0.0-dev (0b2b04)
by Jeroen
02:39
created

ImageValueTest::testEmptyFile()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace JeroenDesloovere\Tests\VCard\Property\Value;
4
5
use JeroenDesloovere\VCard\Property\Value\ImageValue;
6
use PHPUnit\Framework\TestCase;
7
8
/**
9
 * How to execute all tests: `vendor/bin/phpunit tests`
10
 */
11
final class ImageValueTest extends TestCase
12
{
13
    public function testValidLocalImageUrl(): void
14
    {
15
        $image = new ImageValue(__DIR__ . '/../../assets/landscape.jpeg');
16
        $this->assertTrue($image instanceof ImageValue);
17
    }
18
19
    public function testValidImageContent(): void
20
    {
21
        $image = new ImageValue(file_get_contents(__DIR__ . '/../../assets/landscape.jpeg'));
22
        $this->assertTrue($image instanceof ImageValue);
23
    }
24
25
    public function testValidImageUrl(): void
26
    {
27
        $image = new ImageValue('http://www.jeroendesloovere.be/images/my_head.jpg');
28
        $this->assertTrue($image instanceof ImageValue);
29
    }
30
31
    /**
32
     * @expectedException \JeroenDesloovere\VCard\Exception\PropertyException
33
     * @expectedExceptionMessage The image you have provided is invalid.
34
     */
35
    public function testEmptyFile(): void
36
    {
37
        new ImageValue(__DIR__ . '/../../assets/emptyfile');
38
    }
39
40
    /**
41
     * @expectedException \JeroenDesloovere\VCard\Exception\PropertyException
42
     * @expectedExceptionMessage The image you have provided is invalid.
43
     */
44
    public function testEmptyImage(): void
45
    {
46
        new ImageValue(__DIR__ . '/../../assets/empty.jpg');
47
    }
48
49
    /**
50
     * @expectedException \JeroenDesloovere\VCard\Exception\PropertyException
51
     * @expectedExceptionMessage The image you have provided is invalid.
52
     */
53
    public function testWrongFile(): void
54
    {
55
        new ImageValue(__DIR__ . '/../../assets/wrongfile');
56
    }
57
}
58