You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 20, 2023. It is now read-only.
Love the project! Use it extensively across multiple systems but within the last week I've had this problem appear across codebases since I upgrade to 5.5.2 and 5.5.3.
Sample code:
<?php
namespace Tests\Futureproofs\Service;
class ElasticSearch
{
public $elasticSearchService;
public function __construct(\ElasticSearch\Client $elasticSearch)
{
$this->elasticSearchService = $elasticSearch;
}
public function pushToElasticSearch(\FutureproofsLibrary\Document\ProofPage $proofPage, $content = '')
{
$docToIndex = [
'index' => 'proof',
'type' => 'proof_page',
'id' => $proofPage->getId(),
'body' => [
'content' => $content,
'page_number' => $proofPage->getNumber()
]
];
return $this->elasticSearchService->index($docToIndex);
}
}
class ElasticSearchTest extends \PHPUnit_Framework_TestCase
{
public function testPushToElasticSearch()
{
$mockProofPage = new \FutureproofsLibrary\Document\ProofPage();
$mockProofPage->setNumber(2)->setId('pageId');
$elasticSearchMock = $this->getMockBuilder('\ElasticSearch\Client')->setMethods(['index'])->getMock();
$elasticSearchMock->expects($this->at(0))->method('index')->willReturn(true);
$object = new \Tests\Futureproofs\Service\ElasticSearch($elasticSearchMock);
$this->assertTrue($object->pushToElasticSearch($mockProofPage, ''));
}
}
Response:
Fatal error: Call to undefined method Mock_Client_aa099c83::index()
System:
PHPUnit 5.5.3 by Sebastian Bergmann and contributors.
Runtime: PHP 5.6.24 with Xdebug 2.4.0 (OSX)
Configuration: /Users/squire/www/futureproofs/futureproofs-extraction/tests/phpunit.xml.dist
I can't see any reported breaking changes and I've had a hack around in PHPUnit and I can see the mock method being successfully set (InvocationMocker line 287), have I missed something?
Thanks
The text was updated successfully, but these errors were encountered:
Love the project! Use it extensively across multiple systems but within the last week I've had this problem appear across codebases since I upgrade to 5.5.2 and 5.5.3.
Sample code:
Response:
System:
I can't see any reported breaking changes and I've had a hack around in PHPUnit and I can see the mock method being successfully set (InvocationMocker line 287), have I missed something?
Thanks
The text was updated successfully, but these errors were encountered: