mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Switch File::info() tests to use a different file.
text/php files are not detected reliably across platforms. Use a plain text file instead. This should fix builds on travis.ci
This commit is contained in:
parent
d3105332dc
commit
474e42cc08
1 changed files with 16 additions and 15 deletions
|
@ -64,38 +64,39 @@ class FileTest extends CakeTestCase {
|
|||
* @return void
|
||||
*/
|
||||
public function testBasic() {
|
||||
$file = __FILE__;
|
||||
$file = CAKE . DS . 'LICENSE.txt';
|
||||
|
||||
$result = $this->File->pwd();
|
||||
$expecting = $file;
|
||||
$this->assertEquals($expecting, $result);
|
||||
$this->File = new File($file, false);
|
||||
|
||||
$result = $this->File->name;
|
||||
$expecting = basename(__FILE__);
|
||||
$expecting = basename($file);
|
||||
$this->assertEquals($expecting, $result);
|
||||
|
||||
$result = $this->File->info();
|
||||
$expecting = array(
|
||||
'dirname' => dirname(__FILE__),
|
||||
'basename' => basename(__FILE__),
|
||||
'extension' => 'php',
|
||||
'filename' => 'FileTest',
|
||||
'dirname' => dirname($file),
|
||||
'basename' => basename($file),
|
||||
'extension' => 'txt',
|
||||
'filename' => 'LICENSE',
|
||||
'filesize' => filesize($file),
|
||||
'mime' => 'text/x-php'
|
||||
'mime' => 'text/plain'
|
||||
);
|
||||
if (!function_exists('finfo_open') && (!function_exists('mime_content_type') ||
|
||||
function_exists('mime_content_type') && false === mime_content_type($this->File->pwd()))) {
|
||||
if (
|
||||
!function_exists('finfo_open') &&
|
||||
(!function_exists('mime_content_type') ||
|
||||
function_exists('mime_content_type') &&
|
||||
mime_content_type($this->File->pwd()) === false)
|
||||
) {
|
||||
$expecting['mime'] = false;
|
||||
}
|
||||
|
||||
$this->assertEquals($expecting, $result);
|
||||
|
||||
$result = $this->File->ext();
|
||||
$expecting = 'php';
|
||||
$expecting = 'txt';
|
||||
$this->assertEquals($expecting, $result);
|
||||
|
||||
$result = $this->File->name();
|
||||
$expecting = 'FileTest';
|
||||
$expecting = 'LICENSE';
|
||||
$this->assertEquals($expecting, $result);
|
||||
|
||||
$result = $this->File->md5();
|
||||
|
|
Loading…
Reference in a new issue