|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
class ImageMetaDataExtensionTest extends SapphireTest |
|
|
|
|
|
|
4
|
|
|
{ |
|
5
|
|
|
public function testProcessExifData() |
|
6
|
|
|
{ |
|
7
|
|
|
$gi = new GalleryImage(); |
|
8
|
|
|
|
|
9
|
|
|
$gi->Title = 'Gallery Image Example'; |
|
|
|
|
|
|
10
|
|
|
|
|
11
|
|
|
$folder = Folder::find_or_make('/ImageMetaDataExtensionTest/'); |
|
12
|
|
|
$testfilePath = 'assets/ImageMetaDataExtensionTest/test.jpg'; // Important: No leading slash |
|
13
|
|
|
|
|
14
|
|
|
$sourcePath = getcwd() . '/ss3gallery/tests/test.jpg'; |
|
15
|
|
|
copy($sourcePath, $testfilePath); |
|
16
|
|
|
$image = new Image(); |
|
17
|
|
|
$image->Filename = $testfilePath; |
|
18
|
|
|
// TODO This should be auto-detected |
|
19
|
|
|
$image->ParentID = $folder->ID; |
|
20
|
|
|
$image->write(); |
|
21
|
|
|
|
|
22
|
|
|
error_log('IMAGE FILENAME: ' . $image->ID); |
|
23
|
|
|
$this->assertEquals('assets/ImageMetaDataExtensionTest/test.jpg', $image->Filename); |
|
|
|
|
|
|
24
|
|
|
|
|
25
|
|
|
$gi->ImageID = $image->ID; |
|
|
|
|
|
|
26
|
|
|
|
|
27
|
|
|
//This will trigger processExifData method |
|
28
|
|
|
$gi->write(); |
|
29
|
|
|
|
|
30
|
|
|
$this->assertTrue($gi->ExifRead); |
|
|
|
|
|
|
31
|
|
|
$this->assertEquals('2.4', $gi->Aperture); |
|
|
|
|
|
|
32
|
|
|
$this->assertEquals('10/160', $gi->ShutterSpeed); |
|
|
|
|
|
|
33
|
|
|
$this->assertEquals(400, $gi->ISO); |
|
|
|
|
|
|
34
|
|
|
$this->assertEquals('2015:09:19 17:40:54', $gi->TakenAt); |
|
|
|
|
|
|
35
|
|
|
$this->assertEquals(Image::ORIENTATION_PORTRAIT, $gi->Orientation); |
|
|
|
|
|
|
36
|
|
|
$this->assertEquals(13.860741666667, $gi->Lat); |
|
|
|
|
|
|
37
|
|
|
$this->assertEquals(100.44168916667, $gi->Lon); |
|
|
|
|
|
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
public function testOnAfterWriteNOT() |
|
41
|
|
|
{ |
|
42
|
|
|
$this->markTestSkipped('TODO'); |
|
|
|
|
|
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
public function testRequireDefaultRecordsNOT() |
|
46
|
|
|
{ |
|
47
|
|
|
$this->markTestSkipped('TODO'); |
|
|
|
|
|
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
public function testGetMappableLatitude() |
|
51
|
|
|
{ |
|
52
|
|
|
$this->markTestSkipped('TODO'); |
|
|
|
|
|
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
public function testGetMappableLongitude() |
|
56
|
|
|
{ |
|
57
|
|
|
$this->markTestSkipped('TODO'); |
|
|
|
|
|
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
public function testGetMappableMapContent() |
|
61
|
|
|
{ |
|
62
|
|
|
$this->markTestSkipped('TODO'); |
|
|
|
|
|
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
public function testGetMappableMapPin() |
|
66
|
|
|
{ |
|
67
|
|
|
$this->markTestSkipped('TODO'); |
|
|
|
|
|
|
68
|
|
|
} |
|
69
|
|
|
} |
|
70
|
|
|
|
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.