2014-02-24 19:17:06 +01:00
|
|
|
<?php
|
2014-03-20 16:54:12 +04:00
|
|
|
namespace PhpWord\Tests;
|
2014-02-24 19:17:06 +01:00
|
|
|
|
2014-03-22 10:06:08 +04:00
|
|
|
use PhpOffice\PhpWord\PhpWord;
|
2014-03-18 17:26:03 +04:00
|
|
|
use PhpOffice\PhpWord\IOFactory;
|
2014-02-24 19:17:06 +01:00
|
|
|
|
|
|
|
|
/**
|
2014-03-19 18:00:19 +04:00
|
|
|
* @@coversDefaultClass PhpOffice\PhpWord\IOFactory
|
2014-03-20 16:54:12 +04:00
|
|
|
* @package PhpWord\Tests
|
2014-02-24 19:17:06 +01:00
|
|
|
* @runTestsInSeparateProcesses
|
|
|
|
|
*/
|
2014-03-19 18:00:19 +04:00
|
|
|
final class IOFactoryTest extends \PHPUnit_Framework_TestCase
|
2014-03-02 14:40:58 -05:00
|
|
|
{
|
2014-03-19 18:00:19 +04:00
|
|
|
/**
|
|
|
|
|
* @covers ::createWriter
|
|
|
|
|
*/
|
|
|
|
|
final public function testExistingWriterCanBeCreated()
|
2014-03-02 14:40:58 -05:00
|
|
|
{
|
2014-03-19 18:00:19 +04:00
|
|
|
$this->assertInstanceOf(
|
|
|
|
|
'PhpOffice\\PhpWord\\Writer\\Word2007',
|
2014-03-20 16:54:12 +04:00
|
|
|
IOFactory::createWriter(new PhpWord(), 'Word2007')
|
2014-03-12 13:30:02 +07:00
|
|
|
);
|
2014-03-02 14:40:58 -05:00
|
|
|
}
|
|
|
|
|
|
2014-03-19 18:00:19 +04:00
|
|
|
/**
|
|
|
|
|
* @covers ::createWriter
|
|
|
|
|
* @expectedException PhpOffice\PhpWord\Exceptions\Exception
|
|
|
|
|
* @expectedExceptionMessage Could not instantiate "Word2006" class.
|
|
|
|
|
*/
|
|
|
|
|
final public function testNonexistentWriterCanNotBeCreated()
|
2014-03-02 14:40:58 -05:00
|
|
|
{
|
2014-03-20 16:54:12 +04:00
|
|
|
IOFactory::createWriter(new PhpWord(), 'Word2006');
|
2014-03-02 14:40:58 -05:00
|
|
|
}
|
|
|
|
|
|
2014-03-19 18:00:19 +04:00
|
|
|
/**
|
|
|
|
|
* @covers ::createReader
|
|
|
|
|
*/
|
|
|
|
|
final public function testExistingReaderCanBeCreated()
|
2014-03-02 14:40:58 -05:00
|
|
|
{
|
2014-03-19 18:00:19 +04:00
|
|
|
$this->assertInstanceOf(
|
|
|
|
|
'PhpOffice\\PhpWord\\Reader\\Word2007',
|
|
|
|
|
IOFactory::createReader('Word2007')
|
2014-03-12 13:30:02 +07:00
|
|
|
);
|
2014-03-02 14:40:58 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2014-03-19 18:00:19 +04:00
|
|
|
* @covers ::createReader
|
|
|
|
|
* @expectedException PhpOffice\PhpWord\Exceptions\Exception
|
|
|
|
|
* @expectedExceptionMessage Could not instantiate "Word2006" class.
|
2014-03-02 14:40:58 -05:00
|
|
|
*/
|
2014-03-19 18:00:19 +04:00
|
|
|
final public function testNonexistentReaderCanNotBeCreated()
|
2014-03-02 14:40:58 -05:00
|
|
|
{
|
2014-03-19 18:00:19 +04:00
|
|
|
IOFactory::createReader('Word2006');
|
2014-03-02 14:40:58 -05:00
|
|
|
}
|
2014-03-15 09:27:48 -04:00
|
|
|
}
|