Skip to content

Remove unneeded stubs from tests - #100

Merged
WyriHaximus merged 3 commits into
reactphp:masterfrom
legionth:remove-stubs
Feb 9, 2017
Merged

Remove unneeded stubs from tests#100
WyriHaximus merged 3 commits into
reactphp:masterfrom
legionth:remove-stubs

Conversation

@legionth

Copy link
Copy Markdown
Contributor

The stubs aren't needed in the tests and can be replaced by a simple Connection mock.

This will make it easier to create tests for an upcoming PSR-7 PR.

Comment threadtests/ServerTest.php
->withConsecutive(
array($this->equalTo("HTTP/1.1 200 OK\r\nX-Powered-By: React/alpha\r\nTransfer-Encoding: chunked\r\n\r\n")),
array($this->equalTo("0\r\n\r\n"))
);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but doesn't match with the test title anymore?

Comment threadtests/ServerTest.php Outdated
public function testRequestEventIsEmitted()
{
$io = new ServerStub();
$socket = new Socket($this->loop);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about using a mock here? (refs #93)

See also below.

@clueclue added this to the v0.4.3 milestone Feb 9, 2017
@legionth

legionth commented Feb 9, 2017

Copy link
Copy Markdown
ContributorAuthor

Updated. Checkout the newest commits.

clue
clue approved these changes Feb 9, 2017

@clueclue left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@WyriHaximus
WyriHaximus requested a review from jsorFebruary 9, 2017 17:37
jsor
jsor approved these changes Feb 9, 2017

@jsorjsor left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pesonally, I'd have preferred factory methods for creating the mocks, but i'm good with either.

@WyriHaximus
WyriHaximus merged commit 51be115 into reactphp:masterFeb 9, 2017
@legionth
legionth deleted the remove-stubs branch February 16, 2017 11:34
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@legionth@jsor@WyriHaximus@clue