for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
class TestWithImage extends SapphireTest {
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.
public function setUp() {
parent::setUp();
$folder = Folder::find_or_make('/TestImageSS3Gallery/');
$testfilePath = 'assets/TestImageSS3Gallery/test.jpg'; // Important: No leading slash
$sourcePath = getcwd() . '/ss3gallery/tests/test.jpg';
copy($sourcePath, $testfilePath);
$image = new Image();
$image->Title = 'Test Image';
$image->Filename = $testfilePath;
// TODO This should be auto-detected
$image->ParentID = $folder->ID;
$image->write();
}
public function tearDown() {
unlink('assets/TestImageSS3Gallery/test.jpg');
parent::tearDown();
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.