2014-03-10 13:29:48 +07:00
|
|
|
<?php
|
2014-03-23 11:59:22 -04:00
|
|
|
namespace PhpOffice\PhpWord\Tests\Shared;
|
2014-03-10 13:29:48 +07:00
|
|
|
|
2014-03-19 11:04:48 +04:00
|
|
|
use PhpOffice\PhpWord\Shared\File;
|
2014-03-10 13:29:48 +07:00
|
|
|
|
|
|
|
|
/**
|
2014-03-23 10:32:08 +04:00
|
|
|
* @coversDefaultClass \PhpOffice\PhpWord\Shared\File
|
2014-03-10 13:29:48 +07:00
|
|
|
* @runTestsInSeparateProcesses
|
|
|
|
|
*/
|
|
|
|
|
class FileTest extends \PHPUnit_Framework_TestCase
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* Test file_exists()
|
|
|
|
|
*/
|
2014-03-11 21:44:54 +07:00
|
|
|
public function testFileExists()
|
2014-03-10 13:29:48 +07:00
|
|
|
{
|
2014-03-23 12:37:31 -04:00
|
|
|
$dir = __DIR__ . "/../_files/templates";
|
2014-03-15 14:48:26 +07:00
|
|
|
chdir($dir);
|
2014-03-24 00:26:10 +07:00
|
|
|
$this->assertTrue(File::fileExists('blank.docx'));
|
2014-03-14 20:36:09 +01:00
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* Test file_exists()
|
|
|
|
|
*/
|
|
|
|
|
public function testNoFileExists()
|
|
|
|
|
{
|
2014-03-23 12:37:31 -04:00
|
|
|
$dir = __DIR__ . "/../_files/templates";
|
2014-03-15 14:48:26 +07:00
|
|
|
chdir($dir);
|
2014-03-24 00:26:10 +07:00
|
|
|
$this->assertFalse(File::fileExists('404.docx'));
|
2014-03-10 13:29:48 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Test realpath()
|
|
|
|
|
*/
|
|
|
|
|
public function testRealpath()
|
|
|
|
|
{
|
2014-03-23 12:37:31 -04:00
|
|
|
$dir = realpath(__DIR__ . "/../_files/templates");
|
2014-03-15 14:48:26 +07:00
|
|
|
chdir($dir);
|
|
|
|
|
$file = 'blank.docx';
|
2014-03-23 10:32:08 +04:00
|
|
|
$expected = $dir . \DIRECTORY_SEPARATOR . $file;
|
2014-03-19 11:04:48 +04:00
|
|
|
$this->assertEquals($expected, File::realpath($file));
|
2014-03-10 13:29:48 +07:00
|
|
|
}
|
2014-03-23 17:37:26 +07:00
|
|
|
}
|