Skip to content

Fix for unit tests. #172

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
1 commit merged into from Mar 25, 2014
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);
}
}