1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-09 23:36:37 +02:00

fixed basePath()

This commit is contained in:
Oliver Vogel
2015-11-26 12:44:27 +01:00
parent 2d8de6577b
commit cff322864b
4 changed files with 24 additions and 20 deletions

View File

@@ -75,4 +75,18 @@ class File
return false; return false;
} }
/**
* Get fully qualified path
*
* @return string
*/
public function basePath()
{
if ($this->dirname && $this->basename) {
return ($this->dirname .'/'. $this->basename);
}
return null;
}
} }

View File

@@ -343,20 +343,6 @@ class Image extends File
return $this->mime; return $this->mime;
} }
/**
* Get fully qualified path to image
*
* @return string
*/
public function basePath()
{
if ($this->dirname && $this->basename) {
return ($this->dirname .'/'. $this->basename);
}
return null;
}
/** /**
* Returns encoded image data in string conversion * Returns encoded image data in string conversion
* *

View File

@@ -14,4 +14,14 @@ class FileTest extends PHPUnit_Framework_TestCase
$this->assertEquals('test', $file->filename); $this->assertEquals('test', $file->filename);
$this->assertEquals('image/jpeg', $file->mime); $this->assertEquals('image/jpeg', $file->mime);
} }
public function testBasePath()
{
$file = new File;
$this->assertNull(null, $file->basePath());
$file->dirname = 'foo';
$file->basename = 'bar';
$this->assertEquals('foo/bar', $file->basePath());
}
} }

View File

@@ -66,12 +66,6 @@ class ImageTest extends PHPUnit_Framework_TestCase
$this->assertEquals('image/png', $image->mime()); $this->assertEquals('image/png', $image->mime());
} }
public function testBasePath()
{
$image = $this->getTestImage();
$this->assertEquals('./tmp/foo.png', $image->basePath());
}
/** /**
* @expectedException \Intervention\Image\Exception\RuntimeException * @expectedException \Intervention\Image\Exception\RuntimeException
*/ */