Skip to content

Commit c8d360e

Browse files
committed
Use PSR autoload mechanism for tests
1 parent 2bc7577 commit c8d360e

File tree

163 files changed

+330
-201
lines changed

Some content is hidden

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

163 files changed

+330
-201
lines changed

composer.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
"require-dev": {
6969
"ext-zip": "*",
7070
"ext-gd": "*",
71+
"ext-libxml": "*",
7172
"dompdf/dompdf": "^2.0",
7273
"friendsofphp/php-cs-fixer": "^3.11",
7374
"mpdf/mpdf": "^8.1",
@@ -90,6 +91,11 @@
9091
"PhpOffice\\PhpWord\\": "src/PhpWord"
9192
}
9293
},
94+
"autoload-dev": {
95+
"psr-4": {
96+
"PhpOffice\\PhpWordTests\\": "tests/PhpWordTests"
97+
}
98+
},
9399
"extra": {
94100
"branch-alias": {
95101
"dev-develop": "0.19-dev"

phpunit.xml.dist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
stopOnFailure="false">
1010
<testsuites>
1111
<testsuite name="PhpWord Test Suite">
12-
<directory>./tests/PhpWord</directory>
12+
<directory>./tests/PhpWordTests</directory>
1313
</testsuite>
1414
</testsuites>
1515
<filter>
1616
<whitelist>
1717
<directory suffix=".php">./src</directory>
1818
<exclude>
19-
<directory suffix=".php">./src/PhpWord/Shared/PCLZip</directory>
19+
<directory suffix=".php">./src/PhpWordTests/Shared/PCLZip</directory>
2020
</exclude>
2121
</whitelist>
2222
</filter>

tests/PhpWord/_includes/AbstractTestReader.php renamed to tests/PhpWordTests/AbstractTestReader.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@
1515
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
1616
*/
1717

18-
namespace PhpOffice\PhpWord;
18+
namespace PhpOffice\PhpWordTests;
1919

20+
use PhpOffice\PhpWord\PhpWord;
2021
use ZipArchive;
2122

2223
/**
@@ -39,9 +40,9 @@ abstract class AbstractTestReader extends \PHPUnit\Framework\TestCase
3940
*/
4041
protected function getDocumentFromString(array $partXmls = [])
4142
{
42-
$file = __DIR__ . '/../_files/temp.docx';
43+
$file = __DIR__ . '/_files/temp.docx';
4344
$zip = new ZipArchive();
44-
$zip->open($file, ZipArchive::CREATE);
45+
$zip->open($file, ZipArchive::CREATE | ZipArchive::OVERWRITE);
4546
foreach ($this->parts as $partName => $part) {
4647
if (array_key_exists($partName, $partXmls)) {
4748
$zip->addFromString("{$partName}.xml", str_replace('{toReplace}', $partXmls[$partName], $this->parts[$partName]['xml']));

tests/PhpWord/_includes/AbstractWebServerEmbeddedTest.php renamed to tests/PhpWordTests/AbstractWebServerEmbeddedTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
1616
*/
1717

18-
namespace PhpOffice\PhpWord;
18+
namespace PhpOffice\PhpWordTests;
1919

2020
use Symfony\Component\Process\Process;
2121

@@ -25,7 +25,7 @@ abstract class AbstractWebServerEmbeddedTest extends \PHPUnit\Framework\TestCase
2525

2626
public static function setUpBeforeClass(): void
2727
{
28-
$commandLine = 'php -S localhost:8080 -t tests/PhpWord/_files';
28+
$commandLine = 'php -S localhost:8080 -t tests/PhpWordTests/_files';
2929

3030
self::$httpServer = Process::fromShellCommandline($commandLine);
3131
self::$httpServer->start();

tests/PhpWord/Collection/CollectionTest.php renamed to tests/PhpWordTests/Collection/CollectionTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
1515
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
1616
*/
1717

18-
namespace PhpOffice\PhpWord\Collection;
18+
namespace PhpOffice\PhpWordTests\Collection;
1919

2020
use PhpOffice\PhpWord\Element\Footnote;
21+
use PhpOffice\PhpWord\Collection\Footnotes;
2122

2223
/**
2324
* Test class for PhpOffice\PhpWord\Collection subnamespace.

tests/PhpWord/ComplexType/FootnotePropertiesTest.php renamed to tests/PhpWordTests/ComplexType/FootnotePropertiesTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
1515
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
1616
*/
1717

18-
namespace PhpOffice\PhpWord\ComplexType;
18+
namespace PhpOffice\PhpWordTests\ComplexType;
1919

2020
use InvalidArgumentException;
21+
use PhpOffice\PhpWord\ComplexType\FootnoteProperties;
2122
use PhpOffice\PhpWord\SimpleType\NumberFormat;
2223

2324
/**

tests/PhpWord/ComplexType/ProofStateTest.php renamed to tests/PhpWordTests/ComplexType/ProofStateTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
1515
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
1616
*/
1717

18-
namespace PhpOffice\PhpWord\ComplexType;
18+
namespace PhpOffice\PhpWordTests\ComplexType;
1919

2020
use InvalidArgumentException;
21+
use PhpOffice\PhpWord\ComplexType\ProofState;
2122

2223
/**
2324
* Test class for PhpOffice\PhpWord\ComplexType\ProofState.

tests/PhpWord/Element/AbstractElementTest.php renamed to tests/PhpWordTests/Element/AbstractElementTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
1616
*/
1717

18-
namespace PhpOffice\PhpWord\Element;
18+
namespace PhpOffice\PhpWordTests\Element;
1919

2020
/**
2121
* Test class for PhpOffice\PhpWord\Element\AbstractElement.

tests/PhpWord/Element/BookmarkTest.php renamed to tests/PhpWordTests/Element/BookmarkTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
1616
*/
1717

18-
namespace PhpOffice\PhpWord\Element;
18+
namespace PhpOffice\PhpWordTests\Element;
19+
20+
use PhpOffice\PhpWord\Element\Bookmark;
1921

2022
/**
2123
* Test class for PhpOffice\PhpWord\Element\Footer.

tests/PhpWord/Element/CellTest.php renamed to tests/PhpWordTests/Element/CellTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@
1515
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
1616
*/
1717

18-
namespace PhpOffice\PhpWord\Element;
18+
namespace PhpOffice\PhpWordTests\Element;
1919

2020
use BadMethodCallException;
21-
use PhpOffice\PhpWord\AbstractWebServerEmbeddedTest;
21+
use PhpOffice\PhpWord\Element\Cell;
22+
use PhpOffice\PhpWordTests\AbstractWebServerEmbeddedTest;
2223

2324
/**
2425
* Test class for PhpOffice\PhpWord\Element\Cell.

0 commit comments

Comments
 (0)