Skip to content

Commit ddb6277

Browse files
author
Roman Syroeshko
committed
#58 - More fixes.
1 parent 7e23484 commit ddb6277

File tree

137 files changed

+626
-889
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

137 files changed

+626
-889
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,15 @@ $section->addText('Hello world! I am formatted by a user defined style',
103103
'myOwnStyle');
104104

105105
// You can also put the appended element to local object like this:
106-
$fontStyle = new PhpOffice\PhpWord\Style\Font();
106+
$fontStyle = new \PhpOffice\PhpWord\Style\Font();
107107
$fontStyle->setBold(true);
108108
$fontStyle->setName('Verdana');
109109
$fontStyle->setSize(22);
110110
$myTextElement = $section->addText('Hello World!');
111111
$myTextElement->setFontStyle($fontStyle);
112112

113113
// Finally, write the document:
114-
$xmlWriter = PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007');
114+
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007');
115115
$xmlWriter->save('helloWorld.docx');
116116
```
117117

@@ -125,15 +125,15 @@ You can use PhpWord helper functions to convert inches, centimeters, or points t
125125
```php
126126
// Paragraph with 6 points space after
127127
$phpWord->addParagraphStyle('My Style', array(
128-
'spaceAfter' => PhpOffice\PhpWord\Shared\Font::pointSizeToTwips(6))
128+
'spaceAfter' => \PhpOffice\PhpWord\Shared\Font::pointSizeToTwips(6))
129129
);
130130

131131
$section = $phpWord->createSection();
132132
$sectionStyle = $section->getSettings();
133133
// half inch left margin
134-
$sectionStyle->setMarginLeft(PhpOffice\PhpWord\Shared\Font::inchSizeToTwips(.5));
134+
$sectionStyle->setMarginLeft(\PhpOffice\PhpWord\Shared\Font::inchSizeToTwips(.5));
135135
// 2 cm right margin
136-
$sectionStyle->setMarginRight(PhpOffice\PhpWord\Shared\Font::centimeterSizeToTwips(2));
136+
$sectionStyle->setMarginRight(\PhpOffice\PhpWord\Shared\Font::centimeterSizeToTwips(2));
137137
```
138138

139139
<a name="sections"></a>

Tests/PhpWord/DocumentPropertiesTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
use PhpOffice\PhpWord\DocumentProperties;
55

66
/**
7-
* @package PhpWord\Tests
8-
* @coversDefaultClass PhpOffice\PhpWord\DocumentProperties
7+
* @coversDefaultClass \PhpOffice\PhpWord\DocumentProperties
98
* @runTestsInSeparateProcesses
109
*/
1110
class DocumentPropertiesTest extends \PHPUnit_Framework_TestCase

Tests/PhpWord/Exceptions/ExceptionTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
class ExceptionTest extends \PHPUnit_Framework_TestCase
77
{
88
/**
9-
* @expectedException PhpOffice\PhpWord\Exceptions\Exception
10-
* @covers PhpOffice\PhpWord\Exceptions\Exception
9+
* @expectedException \PhpOffice\PhpWord\Exceptions\Exception
10+
* @covers \PhpOffice\PhpWord\Exceptions\Exception
1111
*/
1212
public function testThrowException()
1313
{

Tests/PhpWord/Exceptions/InvalidImageExceptionTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
class InvalidImageExceptionTest extends \PHPUnit_Framework_TestCase
77
{
88
/**
9-
* @expectedException PhpOffice\PhpWord\Exceptions\InvalidImageException
10-
* @covers PhpOffice\PhpWord\Exceptions\InvalidImageException
9+
* @expectedException \PhpOffice\PhpWord\Exceptions\InvalidImageException
10+
* @covers \PhpOffice\PhpWord\Exceptions\InvalidImageException
1111
*/
1212
public function testThrowException()
1313
{

Tests/PhpWord/Exceptions/InvalidStyleExceptionTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
class InvalidStyleExceptionTest extends \PHPUnit_Framework_TestCase
77
{
88
/**
9-
* @expectedException PhpOffice\PhpWord\Exceptions\InvalidStyleException
10-
* @covers PhpOffice\PhpWord\Exceptions\InvalidStyleException
9+
* @expectedException \PhpOffice\PhpWord\Exceptions\InvalidStyleException
10+
* @covers \PhpOffice\PhpWord\Exceptions\InvalidStyleException
1111
*/
1212
public function testThrowException()
1313
{

Tests/PhpWord/Exceptions/UnsupportedImageTypeExceptionTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
class UnsupportedImageTypeExceptionTest extends \PHPUnit_Framework_TestCase
77
{
88
/**
9-
* @expectedException PhpOffice\PhpWord\Exceptions\UnsupportedImageTypeException
10-
* @covers PhpOffice\PhpWord\Exceptions\UnsupportedImageTypeException
9+
* @expectedException \PhpOffice\PhpWord\Exceptions\UnsupportedImageTypeException
10+
* @covers \PhpOffice\PhpWord\Exceptions\UnsupportedImageTypeException
1111
*/
1212
public function testThrowException()
1313
{

Tests/PhpWord/IOFactoryTest.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
use PhpOffice\PhpWord\IOFactory;
66

77
/**
8-
* @@coversDefaultClass PhpOffice\PhpWord\IOFactory
9-
* @package PhpWord\Tests
8+
* @coversDefaultClass \PhpOffice\PhpWord\IOFactory
109
* @runTestsInSeparateProcesses
1110
*/
1211
final class IOFactoryTest extends \PHPUnit_Framework_TestCase
@@ -24,7 +23,7 @@ final public function testExistingWriterCanBeCreated()
2423

2524
/**
2625
* @covers ::createWriter
27-
* @expectedException PhpOffice\PhpWord\Exceptions\Exception
26+
* @expectedException \PhpOffice\PhpWord\Exceptions\Exception
2827
* @expectedExceptionMessage Could not instantiate "Word2006" class.
2928
*/
3029
final public function testNonexistentWriterCanNotBeCreated()
@@ -45,7 +44,7 @@ final public function testExistingReaderCanBeCreated()
4544

4645
/**
4746
* @covers ::createReader
48-
* @expectedException PhpOffice\PhpWord\Exceptions\Exception
47+
* @expectedException \PhpOffice\PhpWord\Exceptions\Exception
4948
* @expectedExceptionMessage Could not instantiate "Word2006" class.
5049
*/
5150
final public function testNonexistentReaderCanNotBeCreated()

Tests/PhpWord/MediaTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function testGetFooterMediaElements()
3737
/**
3838
* Todo: add memory image to this test
3939
*
40-
* @covers PhpOffice\PhpWord\Media::addSectionMediaElement
40+
* @covers \PhpOffice\PhpWord\Media::addSectionMediaElement
4141
*/
4242
public function testAddSectionMediaElement()
4343
{

Tests/PhpWord/Reader/Word2007Test.php

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,8 @@
44
use PhpOffice\PhpWord\Reader\Word2007;
55
use PhpOffice\PhpWord\IOFactory;
66

7-
/**
8-
* @package PhpWord\Tests
9-
*/
107
class Word2007Test extends \PHPUnit_Framework_TestCase
118
{
12-
/** @var Test file directory */
13-
private $dir;
14-
159
/**
1610
* Init
1711
*/
@@ -25,27 +19,25 @@ public function tearDown()
2519
public function testCanRead()
2620
{
2721
$dir = join(
28-
DIRECTORY_SEPARATOR,
22+
\DIRECTORY_SEPARATOR,
2923
array(\PHPWORD_TESTS_BASE_DIR, '_files', 'documents')
3024
);
3125
$object = new Word2007;
32-
$file = $dir . DIRECTORY_SEPARATOR . 'reader.docx';
26+
$file = $dir . \DIRECTORY_SEPARATOR . 'reader.docx';
3327
$this->assertTrue($object->canRead($file));
3428
}
3529

3630
/**
37-
* Test canRead() failure
38-
*
39-
* @expectedException Exception
31+
* @expectedException \PhpOffice\PhpWord\Exceptions\Exception
4032
*/
4133
public function testCanReadFailed()
4234
{
4335
$dir = join(
44-
DIRECTORY_SEPARATOR,
36+
\DIRECTORY_SEPARATOR,
4537
array(\PHPWORD_TESTS_BASE_DIR, '_files', 'documents')
4638
);
4739
$object = new Word2007;
48-
$file = $dir . DIRECTORY_SEPARATOR . 'foo.docx';
40+
$file = $dir . \DIRECTORY_SEPARATOR . 'foo.docx';
4941
$this->assertFalse($object->canRead($file));
5042
$object = IOFactory::load($file);
5143
}
@@ -56,10 +48,10 @@ public function testCanReadFailed()
5648
public function testLoad()
5749
{
5850
$dir = join(
59-
DIRECTORY_SEPARATOR,
51+
\DIRECTORY_SEPARATOR,
6052
array(\PHPWORD_TESTS_BASE_DIR, '_files', 'documents')
6153
);
62-
$file = $dir . DIRECTORY_SEPARATOR . 'reader.docx';
54+
$file = $dir . \DIRECTORY_SEPARATOR . 'reader.docx';
6355
$object = IOFactory::load($file);
6456
$this->assertInstanceOf('PhpOffice\\PhpWord\\PhpWord', $object);
6557
}

Tests/PhpWord/Section/ImageTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
use PhpOffice\PhpWord\Section\Image;
55

66
/**
7-
* @coversDefaultClass PhpOffice\PhpWord\Section\Image
7+
* @coversDefaultClass \PhpOffice\PhpWord\Section\Image
88
*/
99
class ImageTest extends \PHPUnit_Framework_TestCase
1010
{
@@ -32,7 +32,7 @@ public function testConstructWithStyle()
3232
$oImage = new Image(
3333
$src,
3434
array('width' => 210, 'height' => 210, 'align' => 'center',
35-
'wrappingStyle' => PhpOffice\PhpWord\Style\Image::WRAPPING_STYLE_BEHIND)
35+
'wrappingStyle' => \PhpOffice\PhpWord\Style\Image::WRAPPING_STYLE_BEHIND)
3636
);
3737

3838
$this->assertInstanceOf('PhpOffice\\PhpWord\\Style\\Image', $oImage->getStyle());
@@ -52,7 +52,7 @@ public function testValidImageTypes()
5252
}
5353

5454
/**
55-
* @expectedException PhpOffice\PhpWord\Exceptions\InvalidImageException
55+
* @expectedException \PhpOffice\PhpWord\Exceptions\InvalidImageException
5656
* @covers ::__construct
5757
*/
5858
public function testImageNotFound()
@@ -61,7 +61,7 @@ public function testImageNotFound()
6161
}
6262

6363
/**
64-
* @expectedException PhpOffice\PhpWord\Exceptions\UnsupportedImageTypeException
64+
* @expectedException \PhpOffice\PhpWord\Exceptions\UnsupportedImageTypeException
6565
* @covers ::__construct
6666
*/
6767
public function testInvalidImageTypes()

0 commit comments

Comments
 (0)