Completed
Push — master ( 18f749...9fc766 )
by Gordon
17:08 queued 02:10
created

TestWithImage   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 23
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 16 1
A tearDown() 0 4 1
1
<?php
2
3
class TestWithImage extends SapphireTest {
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
4
    public function setUp() {
5
        parent::setUp();
6
7
        $folder = Folder::find_or_make('/TestImageSS3Gallery/');
8
        $testfilePath = 'assets/TestImageSS3Gallery/test.jpg'; // Important: No leading slash
9
10
        $sourcePath = getcwd() . '/ss3gallery/tests/test.jpg';
11
        copy($sourcePath, $testfilePath);
12
13
        $image = new Image();
14
        $image->Title = 'Test Image';
15
        $image->Filename = $testfilePath;
16
        // TODO This should be auto-detected
17
        $image->ParentID = $folder->ID;
18
        $image->write();
19
    }
20
21
    public function tearDown() {
22
        unlink('assets/TestImageSS3Gallery/test.jpg');
23
        parent::tearDown();
24
    }
25
}
26