Skip to content

Fix: Use assertSame() #345

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 18, 2019
Merged

Fix: Use assertSame() #345

merged 1 commit into from
Jun 18, 2019

Conversation

localheinz
Copy link
Contributor

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Related tickets n/a
Documentation n/a
License MIT

What's in this PR?

This PR

  • uses assertSame() to harden a test

Why?

When applying the following patch

diff --git a/src/ClientFactory/MockFactory.php b/src/ClientFactory/MockFactory.php
index c56d38c..e57d373 100644
--- a/src/ClientFactory/MockFactory.php
+++ b/src/ClientFactory/MockFactory.php
@@ -10,11 +10,6 @@ use Http\Mock\Client;
  */
 final class MockFactory implements ClientFactory
 {
-    /**
-     * @var HttpClient
-     */
-    private $client;
-
     /**
      * Set the client instance that this factory should return.
      *
@@ -22,7 +17,6 @@ final class MockFactory implements ClientFactory
      */
     public function setClient(HttpClient $client)
     {
-        $this->client = $client;
     }

     /**
@@ -34,10 +28,6 @@ final class MockFactory implements ClientFactory
             throw new \LogicException('To use the mock adapter you need to install the "php-http/mock-client" package.');
         }

-        if (!$this->client) {
-            $this->client = new Client();
-        }
-
-        return $this->client;
+        return new Client();
     }
 }

to current master, the tests still pass.

Copy link
Collaborator

@dbu dbu left a comment

Choose a reason for hiding this comment

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

uuh, indeed. thanks!

@dbu dbu merged commit 5de6c34 into php-http:master Jun 18, 2019
@localheinz localheinz deleted the fix/same branch June 18, 2019 15:41
@localheinz
Copy link
Contributor Author

Thank you, @dbu!

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