Skip to content

Commit

Permalink
Merge pull request #91 from kamilmusial/master
Browse files Browse the repository at this point in the history
Fix test.
  • Loading branch information
kamilmusial authored Jul 7, 2017
2 parents 149e158 + f747340 commit 9d5bac3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Client/YooChooseNotifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ private function notifyGuzzle6(array $events)
)
);

$promise->wait();
$promise->wait(false);

$promise->then(function (Response $response) {
$this->log(sprintf('Got asynchronously %s from YooChoose notification POST', $response->getStatusCode()), 'debug');
Expand Down
20 changes: 7 additions & 13 deletions Tests/Client/YooChooseNotifierTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
*/
namespace EzSystems\RecommendationBundle\Tests\Client;

use Guzzle\Http\Message\Response;
use PHPUnit_Framework_TestCase;
use GuzzleHttp\Message\Response;
use GuzzleHttp\Promise\Promise;
use eZ\Publish\Core\Repository\Values\Content\Content;
use eZ\Publish\Core\Repository\Values\ContentType\ContentType;
use eZ\Publish\API\Repository\Values\Content\ContentInfo;
use EzSystems\RecommendationBundle\Client\YooChooseNotifier;
Expand Down Expand Up @@ -38,11 +37,13 @@ class YooChooseNotifierTest extends PHPUnit_Framework_TestCase
*/
public function setUp()
{
$this->guzzleClientMock = $this->getMock('GuzzleHttp\ClientInterface');

$this->guzzleClientMock = $this->getMockBuilder('GuzzleHttp\ClientInterface')->getMock();
$this->notifier = new YooChooseNotifier(
$this->guzzleClientMock,
$this->getRepositoryServiceMock(self::CONTENT_TYPE_ID),
$this->getContentServiceMock(self::CONTENT_TYPE_ID),
$this->getMockBuilder('eZ\Publish\API\Repository\LocationService')->getMock(),
$this->getMockBuilder('eZ\Publish\API\Repository\ContentTypeService')->getMock(),
array(
'customer-id' => self::CUSTOMER_ID,
'license-key' => self::LICENSE_KEY,
Expand Down Expand Up @@ -181,7 +182,7 @@ protected function setGuzzleExpectations(
*/
protected function getContentServiceMock($contentTypeId)
{
$contentServiceMock = $this->getMock('eZ\Publish\API\Repository\ContentService');
$contentServiceMock = $this->getMockBuilder('eZ\Publish\API\Repository\ContentService')->getMock();

$contentServiceMock
->expects($this->any())
Expand All @@ -202,14 +203,7 @@ protected function getContentServiceMock($contentTypeId)
*/
protected function getRepositoryServiceMock($identifier)
{
$repositoryInterfaceServiceMock = $this->getMock('eZ\Publish\API\Repository\Repository');
$signalDispatcherServiceMock = $this->getMock('eZ\Publish\Core\SignalSlot\SignalDispatcher');

$repositoryServiceMock = $this->getMock(
'eZ\Publish\Core\SignalSlot\Repository',
array('sudo', 'getContentService', 'getContentTypeService'),
array($repositoryInterfaceServiceMock, $signalDispatcherServiceMock)
);
$repositoryServiceMock = $this->getMockBuilder('eZ\Publish\Core\SignalSlot\Repository')->disableOriginalConstructor()->getMock();

$repositoryServiceMock
->expects($this->any())
Expand Down

0 comments on commit 9d5bac3

Please sign in to comment.