Skip to content

Replace deprecated calls to getMock in unit tests #147

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
Apr 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Tests/Unit/ClientFactory/BuzzFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class BuzzFactoryTest extends \PHPUnit_Framework_TestCase
{
public function testCreateClient()
{
$factory = new BuzzFactory($this->getMock(MessageFactory::class));
$factory = new BuzzFactory($this->getMockBuilder(MessageFactory::class)->getMock());
$client = $factory->createClient();

$this->assertInstanceOf(Client::class, $client);
Expand Down
5 changes: 4 additions & 1 deletion Tests/Unit/ClientFactory/CurlFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ class CurlFactoryTest extends \PHPUnit_Framework_TestCase
{
public function testCreateClient()
{
$factory = new CurlFactory($this->getMock(MessageFactory::class), $this->getMock(StreamFactory::class));
$factory = new CurlFactory(
$this->getMockBuilder(MessageFactory::class)->getMock(),
$this->getMockBuilder(StreamFactory::class)->getMock()
);
$client = $factory->createClient();

$this->assertInstanceOf(Client::class, $client);
Expand Down
2 changes: 1 addition & 1 deletion Tests/Unit/ClientFactory/ReactFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class ReactFactoryTest extends \PHPUnit_Framework_TestCase
{
public function testCreateClient()
{
$factory = new ReactFactory($this->getMock(MessageFactory::class));
$factory = new ReactFactory($this->getMockBuilder(MessageFactory::class)->getMock());
$client = $factory->createClient();

$this->assertInstanceOf(Client::class, $client);
Expand Down
2 changes: 1 addition & 1 deletion Tests/Unit/ClientFactory/SocketFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class SocketFactoryTest extends \PHPUnit_Framework_TestCase
{
public function testCreateClient()
{
$factory = new SocketFactory($this->getMock(MessageFactory::class));
$factory = new SocketFactory($this->getMockBuilder(MessageFactory::class)->getMock());
$client = $factory->createClient();

$this->assertInstanceOf(Client::class, $client);
Expand Down
8 changes: 4 additions & 4 deletions Tests/Unit/Discovery/ConfiguredClientsStrategyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ class ConfiguredClientsStrategyTest extends \PHPUnit_Framework_TestCase
{
public function testGetCandidates()
{
$httpClient = $this->getMock(HttpClient::class);
$httpAsyncClient = $this->getMock(HttpAsyncClient::class);
$httpClient = $this->getMockBuilder(HttpClient::class)->getMock();
$httpAsyncClient = $this->getMockBuilder(HttpAsyncClient::class)->getMock();
$strategy = new ConfiguredClientsStrategy($httpClient, $httpAsyncClient);

$candidates = $strategy::getCandidates(HttpClient::class);
Expand All @@ -36,7 +36,7 @@ public function testGetCandidatesEmpty()

public function testGetCandidatesEmptyAsync()
{
$httpClient = $this->getMock(HttpClient::class);
$httpClient = $this->getMockBuilder(HttpClient::class)->getMock();
$strategy = new ConfiguredClientsStrategy($httpClient, null);

$candidates = $strategy::getCandidates(HttpClient::class);
Expand All @@ -49,7 +49,7 @@ public function testGetCandidatesEmptyAsync()

public function testGetCandidatesEmptySync()
{
$httpAsyncClient = $this->getMock(HttpAsyncClient::class);
$httpAsyncClient = $this->getMockBuilder(HttpAsyncClient::class)->getMock();
$strategy = new ConfiguredClientsStrategy(null, $httpAsyncClient);

$candidates = $strategy::getCandidates(HttpClient::class);
Expand Down