Skip to content

Commit 7459b39

Browse files
authored
Fixed broken master (#27)
* Generate password on the fly * Sleep for longer
1 parent a6bfe1b commit 7459b39

17 files changed

+28
-190
lines changed

.travis.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ php:
1010
- 5.5
1111
- 5.6
1212
- 7.0
13-
- hhvm
13+
- 7.1
1414

1515
env:
1616
global:
@@ -23,10 +23,13 @@ branches:
2323
matrix:
2424
allow_failures:
2525
- php: hhvm
26+
dist: trusty
2627
fast_finish: true
2728
include:
2829
- php: 5.5
2930
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" COVERAGE=true TEST_COMMAND="composer test-ci"
31+
- php: hhvm
32+
dist: trusty
3033

3134
before_install:
3235
- travis_retry composer self-update
@@ -38,6 +41,7 @@ before_script:
3841
- vendor/bin/http_test_server > /dev/null 2>&1 &
3942

4043
script:
44+
- cd ./tests/server/ssl && ./generate.sh && pwd && ls -la && cd ../../../
4145
- $TEST_COMMAND
4246
- ./vendor/bin/phpunit tests/SocketClientFeatureTest.php --printer Http\\Client\\Tests\\FeatureTestListener || echo ""
4347

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,15 @@ First launch the http server:
2828
$ ./vendor/bin/http_test_server > /dev/null 2>&1 &
2929
```
3030

31-
Then the test suite:
31+
Then generate ssh certificates:
32+
33+
```bash
34+
$ cd ./tests/server/ssl
35+
$ ./generate.sh
36+
$ cd ../../../
37+
```
38+
39+
Now run the test suite:
3240

3341
``` bash
3442
$ composer test

composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@
1616
"php-http/discovery": "^1.0"
1717
},
1818
"require-dev": {
19-
"phpunit/phpunit": "^4.8",
2019
"guzzlehttp/psr7": "^1.2",
21-
"php-http/client-integration-tests": "^0.5.1",
20+
"php-http/client-integration-tests": "^0.6",
2221
"php-http/message": "^1.0",
2322
"php-http/client-common": "^1.0"
2423
},

tests/BaseTestCase.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
namespace Http\Client\Socket\Tests;
44

5-
class BaseTestCase extends \PHPUnit_Framework_TestCase
5+
use PHPUnit\Framework\TestCase;
6+
7+
class BaseTestCase extends TestCase
68
{
79
private $servers = [];
810

@@ -11,7 +13,7 @@ public function startServer($name)
1113
$filename = __DIR__ . '/server/' . $name . '.php';
1214
$pipes = [];
1315
$this->servers[$name] = proc_open('php '. $filename, [], $pipes);
14-
usleep(30000);
16+
sleep(1);
1517
}
1618

1719
public function stopServer($name)

tests/StreamTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
namespace Http\Client\Socket\Tests;
44

55
use Http\Client\Socket\Stream;
6+
use PHPUnit\Framework\TestCase;
67

7-
class StreamTest extends \PHPUnit_Framework_TestCase
8+
class StreamTest extends TestCase
89
{
910
public function createSocket($body, $useSize = true)
1011
{

tests/server/ssl/ca.pem

Lines changed: 0 additions & 19 deletions
This file was deleted.

tests/server/ssl/client-and-key.pem

Lines changed: 0 additions & 29 deletions
This file was deleted.

tests/server/ssl/client.key

Lines changed: 0 additions & 15 deletions
This file was deleted.

tests/server/ssl/client.pem

Lines changed: 0 additions & 14 deletions
This file was deleted.

tests/server/ssl/client.req

Lines changed: 0 additions & 11 deletions
This file was deleted.

tests/server/ssl/file.srl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2A
1+
2D

tests/server/ssl/generate.sh

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
1-
#/bin/bash
1+
#!/bin/bash
22

33
C=FR
44
ST=Ile-de-France
55
L=Paris
66
O="PHP-HTTP"
77
CN="socket-adapter"
88

9-
openssl req -out ca.pem -new -x509 -subj "/C=$C/ST=$ST/L=$L/O=$O/CN=socket-server"
10-
9+
openssl req -out ca.pem -new -x509 -subj "/C=$C/ST=$ST/L=$L/O=$O/CN=socket-server" -passout pass:password
1110
openssl genrsa -out server.key 1024 -subj "/C=$C/ST=$ST/L=$L/O=$O/CN=socket-adapter"
12-
openssl req -key server.key -new -out server.req -subj "/C=$C/ST=$ST/L=$L/O=$O/CN=socket-adapter"
13-
openssl x509 -req -in server.req -CA ca.pem -CAkey privkey.pem -CAserial file.srl -out server.pem
11+
openssl req -key server.key -new -out server.req -subj "/C=$C/ST=$ST/L=$L/O=$O/CN=socket-adapter" -passout pass:password
12+
openssl x509 -req -in server.req -CA ca.pem -CAkey privkey.pem -CAserial file.srl -out server.pem -passin pass:password
1413

1514
openssl genrsa -out client.key 1024 -subj "/C=$C/ST=$ST/L=$L/O=$O/CN=socket-adapter-client"
16-
openssl req -key client.key -new -out client.req -subj "/C=$C/ST=$ST/L=$L/O=$O/CN=socket-adapter-client"
17-
openssl x509 -req -in client.req -CA ca.pem -CAkey privkey.pem -CAserial file.srl -out client.pem
15+
openssl req -key client.key -new -out client.req -subj "/C=$C/ST=$ST/L=$L/O=$O/CN=socket-adapter-client" -passout pass:password
16+
openssl x509 -req -in client.req -CA ca.pem -CAkey privkey.pem -CAserial file.srl -out client.pem -passin pass:password
1817

1918
cat client.pem client.key > client-and-key.pem
2019
cat server.pem server.key > server-and-key.pem

tests/server/ssl/privkey.pem

Lines changed: 0 additions & 18 deletions
This file was deleted.

tests/server/ssl/server-and-key.pem

Lines changed: 0 additions & 29 deletions
This file was deleted.

tests/server/ssl/server.key

Lines changed: 0 additions & 15 deletions
This file was deleted.

tests/server/ssl/server.pem

Lines changed: 0 additions & 14 deletions
This file was deleted.

tests/server/ssl/server.req

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)