22
33namespace PhpOffice \PhpSpreadsheetTests \Calculation \Functions \Web ;
44
5+ use Exception ;
56use PhpOffice \PhpSpreadsheet \Reader \Xlsx as XlsxReader ;
67use PhpOffice \PhpSpreadsheet \Spreadsheet ;
78use PHPUnit \Framework \TestCase ;
89use Symfony \Component \Process \Process ;
910
10- class ServerTestx extends TestCase
11+ class ServerTest extends TestCase
1112{
1213 private static Process $ httpServer ;
1314
@@ -33,13 +34,22 @@ public static function tearDownAfterClass(): void
3334 self ::$ httpServer ->stop ();
3435 }
3536
36- public function testServer (): void
37+ public function xtestServer (): void
3738 {
38- self ::assertSame (self ::NEWVALUE , file_get_contents (self ::DIRECT ));
39- self ::assertSame (self ::NEWVALUE , file_get_contents (self ::REDIRECT ));
39+ try {
40+ self ::assertSame (self ::NEWVALUE , file_get_contents (self ::DIRECT ));
41+ self ::assertSame (self ::NEWVALUE , file_get_contents (self ::REDIRECT ));
42+ } catch (Exception $ e ) {
43+ $ message = $ e ->getMessage ();
44+ if (str_contains ($ message , 'Connection refused ' )) {
45+ self ::markTestSkipped ('Unable to use web server ' );
46+ }
47+
48+ throw $ e ;
49+ }
4050 }
4151
42- public function testReadFile (): void
52+ public function xtestReadFile (): void
4353 {
4454 $ reader = new XlsxReader ();
4555 $ spreadsheet = $ reader ->load (__DIR__ . '/redirect.xlsx ' );
@@ -51,7 +61,7 @@ public function testReadFile(): void
5161 self ::assertSame (self ::OLDVALUE , $ sheet ->getCell ('A2 ' )->getCalculatedValue (), 'redirect so use old computed ' );
5262 }
5363
54- public static function testNew (): void
64+ public function xtestNew (): void
5565 {
5666 $ spreadsheet = new Spreadsheet ();
5767 $ spreadsheet ->setDomainWhiteList (['localhost ' ]);
@@ -66,4 +76,11 @@ public static function testNew(): void
6676 'redirect so not computed '
6777 );
6878 }
79+
80+ public function testAll (): void
81+ {
82+ $ this ->xtestServer ();
83+ $ this ->xtestReadFile ();
84+ $ this ->xtestNew ();
85+ }
6986}
0 commit comments