Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 18 additions & 15 deletions tests/PhpWord/Tests/Reader/Word2007Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,32 +18,35 @@ public function tearDown()
*/
public function testCanRead()
{
$dir = __DIR__ . "/../_files/documents";
$object = new Word2007;
$file = $dir . \DIRECTORY_SEPARATOR . 'reader.docx';
$this->assertTrue($object->canRead($file));
$object = new Word2007();
$fqFilename = join(
DIRECTORY_SEPARATOR,
array(PHPWORD_TESTS_BASE_DIR, '_files', 'documents', 'reader.docx')
);
$this->assertTrue($object->canRead($fqFilename));
}

/**
* @expectedException \PhpOffice\PhpWord\Exceptions\Exception
*/
public function testCanReadFailed()
{
$dir = __DIR__ . "/../_files/documents";
$object = new Word2007;
$file = $dir . \DIRECTORY_SEPARATOR . 'foo.docx';
$this->assertFalse($object->canRead($file));
$object = IOFactory::load($file);
$object = new Word2007();
$fqFilename = join(
DIRECTORY_SEPARATOR,
array(PHPWORD_TESTS_BASE_DIR, '_files', 'documents', 'foo.docx')
);
$this->assertFalse($object->canRead($fqFilename));
$object = IOFactory::load($fqFilename);
}

/**
* Test load document
*/
public function testLoad()
{
$dir = __DIR__ . "/../_files/documents";
$file = $dir . \DIRECTORY_SEPARATOR . 'reader.docx';
$object = IOFactory::load($file);
$fqFilename = join(
DIRECTORY_SEPARATOR,
array(PHPWORD_TESTS_BASE_DIR, '_files', 'documents', 'reader.docx')
);
$object = IOFactory::load($fqFilename);
$this->assertInstanceOf('PhpOffice\\PhpWord\\PhpWord', $object);
}
}