43 lines
1.1 KiB
PHP
43 lines
1.1 KiB
PHP
<?php
|
|
namespace PhpWord\Tests\Shared;
|
|
|
|
use PhpOffice\PhpWord\Shared\File;
|
|
|
|
/**
|
|
* @package PhpWord\Tests
|
|
* @coversDefaultClass PhpOffice\PhpWord\Shared\File
|
|
* @runTestsInSeparateProcesses
|
|
*/
|
|
class FileTest extends \PHPUnit_Framework_TestCase
|
|
{
|
|
/**
|
|
* Test file_exists()
|
|
*/
|
|
public function testFileExists()
|
|
{
|
|
$dir = join(DIRECTORY_SEPARATOR, array(\PHPWORD_TESTS_BASE_DIR, '_files', 'templates'));
|
|
chdir($dir);
|
|
$this->assertTrue(File::file_exists('blank.docx'));
|
|
}
|
|
/**
|
|
* Test file_exists()
|
|
*/
|
|
public function testNoFileExists()
|
|
{
|
|
$dir = join(DIRECTORY_SEPARATOR, array(\PHPWORD_TESTS_BASE_DIR, '_files', 'templates'));
|
|
chdir($dir);
|
|
$this->assertFalse(File::file_exists('404.docx'));
|
|
}
|
|
|
|
/**
|
|
* Test realpath()
|
|
*/
|
|
public function testRealpath()
|
|
{
|
|
$dir = join(DIRECTORY_SEPARATOR, array(\PHPWORD_TESTS_BASE_DIR, '_files', 'templates'));
|
|
chdir($dir);
|
|
$file = 'blank.docx';
|
|
$expected = $dir . DIRECTORY_SEPARATOR . $file;
|
|
$this->assertEquals($expected, File::realpath($file));
|
|
}
|
|
} |