Skip to content

Commit 3c24c90

Browse files
committed
Restore Test, Account for Unexpected Github Error
1 parent 75bf2eb commit 3c24c90

1 file changed

Lines changed: 23 additions & 6 deletions

File tree

tests/PhpSpreadsheetTests/Calculation/Functions/Web/ServerTestx.php renamed to tests/PhpSpreadsheetTests/Calculation/Functions/Web/ServerTest.php

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22

33
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Web;
44

5+
use Exception;
56
use PhpOffice\PhpSpreadsheet\Reader\Xlsx as XlsxReader;
67
use PhpOffice\PhpSpreadsheet\Spreadsheet;
78
use PHPUnit\Framework\TestCase;
89
use 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

Comments
 (0)