Skip to content

Conversation

@simonLeary42
Copy link
Collaborator

@simonLeary42 simonLeary42 commented Nov 17, 2025

demo: run tests that use the Github API while not connected to wifi

before:

$ docker exec -it docker-dev-web-1 bash -c 'cd /var/www/unity-web-portal && ./vendor/bin/phpunit ./test/unit/UnityGithubTest.php'
PHPUnit 12.4.2 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.3.6
Configuration: /var/www/unity-web-portal/phpunit.xml

...F                                                                4 / 4 (100%)

Time: 00:00.014, Memory: 18.00 MB

There was 1 failure:

1) UnityWebPortal\lib\UnityGithubTest::testGetGithubKeys#3 with data ('simonLeary42', ['ecdsa-sha2-nistp256 AAAAE2VjZ...xaTnk='])
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
 Array (
-    0 => 'ecdsa-sha2-nistp256 AAAAE2VjZ...xaTnk='
 )

/var/www/unity-web-portal/test/unit/UnityGithubTest.php:33

FAILURES!
Tests: 4, Assertions: 4, Failures: 1.

after:

$ docker exec -it docker-dev-web-1 bash -c 'cd /var/www/unity-web-portal && ./vendor/bin/phpunit ./test/unit/UnityGithubTest.php'
PHPUnit 12.4.2 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.3.6
Configuration: /var/www/unity-web-portal/phpunit.xml

EEEE                                                                4 / 4 (100%)

Time: 00:00.013, Memory: 18.00 MB

There were 4 errors:

1) UnityWebPortal\lib\UnityGithubTest::testGetGithubKeys#0 with data ('', [])
UnityWebPortal\lib\exceptions\CurlException: Could not resolve host: api.github.com

/var/www/unity-web-portal/resources/lib/UnityGithub.php:19
/var/www/unity-web-portal/test/unit/UnityGithubTest.php:33

2) UnityWebPortal\lib\UnityGithubTest::testGetGithubKeys#1 with data ('asdfkljhasdflkjashdflkjashdflkasjd', [])
UnityWebPortal\lib\exceptions\CurlException: Could not resolve host: api.github.com

/var/www/unity-web-portal/resources/lib/UnityGithub.php:19
/var/www/unity-web-portal/test/unit/UnityGithubTest.php:33

3) UnityWebPortal\lib\UnityGithubTest::testGetGithubKeys#2 with data ('sheldor1510', [])
UnityWebPortal\lib\exceptions\CurlException: Could not resolve host: api.github.com

/var/www/unity-web-portal/resources/lib/UnityGithub.php:19
/var/www/unity-web-portal/test/unit/UnityGithubTest.php:33

4) UnityWebPortal\lib\UnityGithubTest::testGetGithubKeys#3 with data ('simonLeary42', ['ecdsa-sha2-nistp256 AAAAE2VjZ...xaTnk='])
UnityWebPortal\lib\exceptions\CurlException: Could not resolve host: api.github.com

/var/www/unity-web-portal/resources/lib/UnityGithub.php:19
/var/www/unity-web-portal/test/unit/UnityGithubTest.php:33

ERRORS!
Tests: 4, Assertions: 0, Errors: 4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants