4
4
use PhpOffice \PhpWord \Reader \Word2007 ;
5
5
use PhpOffice \PhpWord \IOFactory ;
6
6
7
- /**
8
- * @package PhpWord\Tests
9
- */
10
7
class Word2007Test extends \PHPUnit_Framework_TestCase
11
8
{
12
- /** @var Test file directory */
13
- private $ dir ;
14
-
15
9
/**
16
10
* Init
17
11
*/
@@ -25,27 +19,25 @@ public function tearDown()
25
19
public function testCanRead ()
26
20
{
27
21
$ dir = join (
28
- DIRECTORY_SEPARATOR ,
22
+ \ DIRECTORY_SEPARATOR ,
29
23
array (\PHPWORD_TESTS_BASE_DIR , '_files ' , 'documents ' )
30
24
);
31
25
$ object = new Word2007 ;
32
- $ file = $ dir . DIRECTORY_SEPARATOR . 'reader.docx ' ;
26
+ $ file = $ dir . \ DIRECTORY_SEPARATOR . 'reader.docx ' ;
33
27
$ this ->assertTrue ($ object ->canRead ($ file ));
34
28
}
35
29
36
30
/**
37
- * Test canRead() failure
38
- *
39
- * @expectedException Exception
31
+ * @expectedException \PhpOffice\PhpWord\Exceptions\Exception
40
32
*/
41
33
public function testCanReadFailed ()
42
34
{
43
35
$ dir = join (
44
- DIRECTORY_SEPARATOR ,
36
+ \ DIRECTORY_SEPARATOR ,
45
37
array (\PHPWORD_TESTS_BASE_DIR , '_files ' , 'documents ' )
46
38
);
47
39
$ object = new Word2007 ;
48
- $ file = $ dir . DIRECTORY_SEPARATOR . 'foo.docx ' ;
40
+ $ file = $ dir . \ DIRECTORY_SEPARATOR . 'foo.docx ' ;
49
41
$ this ->assertFalse ($ object ->canRead ($ file ));
50
42
$ object = IOFactory::load ($ file );
51
43
}
@@ -56,10 +48,10 @@ public function testCanReadFailed()
56
48
public function testLoad ()
57
49
{
58
50
$ dir = join (
59
- DIRECTORY_SEPARATOR ,
51
+ \ DIRECTORY_SEPARATOR ,
60
52
array (\PHPWORD_TESTS_BASE_DIR , '_files ' , 'documents ' )
61
53
);
62
- $ file = $ dir . DIRECTORY_SEPARATOR . 'reader.docx ' ;
54
+ $ file = $ dir . \ DIRECTORY_SEPARATOR . 'reader.docx ' ;
63
55
$ object = IOFactory::load ($ file );
64
56
$ this ->assertInstanceOf ('PhpOffice \\PhpWord \\PhpWord ' , $ object );
65
57
}
0 commit comments