amphp / websocket-server

WebSocket component for PHP based on the Amp HTTP server.
MIT License
114 stars 17 forks source link

Interface hints against final classes #4

Closed PeeHaa closed 6 years ago

PeeHaa commented 6 years ago

The Application interface hints against final classes like Amp\Http\Server\Request and Amp\Http\Server\Response making trying to run tests harder than need be.

kelunik commented 6 years ago

@PeeHaa Why? By that definition that issue should be opened on amphp/http-server, because it affects every RequestHandler. You can simply create a Request and Response object instead of creating a mock.

PeeHaa commented 6 years ago

Could be that it is needed in http server too. Hit the issue here in websocket.

The reason I want to use a mock is that mocks come with stuff like number of calls to a specific method and param passing assertion out of the box.

kelunik commented 6 years ago

You're probably testing internals that shouldn't really be tested? I assume you're only really interested in the result of the code, not how it is actually produced?

Adding an interface for Request / Response turns every addition into a BC break, while currently we could add methods at any time.

PeeHaa commented 6 years ago

Having an interface doesn't prevent you from adding methods. It prevents you from adding methods to that specific interface.

And yes I am using it as a spy.

kelunik commented 6 years ago

I'll close this issue. If a change is really to be made, it has to happen in amphp/http-server.