I am using Ratchet for websockets in PHP. I was able to write unit (phpspec) and acceptance tests (behat) for websockets but I cannot find a way on how to test the connection to the websocket server by using a functional phpunit test.. I think a test, which checks if the connection is up and running, would be very important. I thought of something like the following:
- Create a (ratchet) client in phpunit
- Connect to ws url (e.g. client->connect(host, port, ...)
- ping websocket / send / receive some messages (call methods of client, e.g. client->push(..)..)
The problem is, that I don't know which class is responsible for establishing the connection (creating a client which can request the websocket) in Ratchet and how a test would then look like. How can I create a Ratchet Client to be able to connect and request a websocket in phpunit functional test?
Aucun commentaire:
Enregistrer un commentaire