2014-02-24 19:17:06 +01:00
|
|
|
<?php
|
2014-03-27 23:55:06 +07:00
|
|
|
/**
|
|
|
|
|
* PHPWord
|
|
|
|
|
*
|
|
|
|
|
* @link https://github.com/PHPOffice/PHPWord
|
|
|
|
|
* @copyright 2014 PHPWord
|
|
|
|
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
|
|
|
|
*/
|
|
|
|
|
|
2014-03-23 11:59:22 -04:00
|
|
|
namespace PhpOffice\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-27 23:55:06 +07:00
|
|
|
* Test class for PhpOffice\PhpWord\IOFactory
|
|
|
|
|
*
|
|
|
|
|
* @coversDefaultClass \PhpOffice\PhpWord\IOFactory
|
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
|
2014-03-23 10:32:08 +04:00
|
|
|
* @expectedException \PhpOffice\PhpWord\Exceptions\Exception
|
2014-03-19 18:00:19 +04:00
|
|
|
*/
|
|
|
|
|
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
|
2014-03-23 10:32:08 +04:00
|
|
|
* @expectedException \PhpOffice\PhpWord\Exceptions\Exception
|
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-23 17:37:26 +07:00
|
|
|
}
|