Skip to content

Commit

Permalink
[TEST] add PHPStan to build (#628)
Browse files Browse the repository at this point in the history
* PHPUnit 5.7.21 + update config + fix risky tests

* PHPUnit 6.3.0

* use $this->expectException instead of annotation

* [TEST] fixes of issues detected by phpstan

* phpstan setup
  • Loading branch information
mhujer authored and polyfractal committed Nov 14, 2017
1 parent 18a38dd commit 946cd65
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
9 changes: 9 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
parameters:
ignoreErrors:
- '#Mockery\\MockInterface::shouldReceive\(\)#'
- '#Mockery\\MockInterface given#'
- '#Mockery\\MockInterface\[\] given#'

# because of \Elasticsearch\Tests\RegisteredNamespaceTest
- '#Call to an undefined method Elasticsearch\\Client::foo\(\)#'
- '#Call to an undefined method Elasticsearch\\Client::bar\(\)#'
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ public function testAllHostsFailPing()
$this->expectException(\Elasticsearch\Common\Exceptions\NoNodesAvailableException::class);
$this->expectExceptionMessage('No alive nodes found in your cluster');

$this->expectException(\Elasticsearch\Common\Exceptions\NoNodesAvailableException::class);
$this->expectExceptionMessage('No alive nodes found in your cluster');

$connectionPool->nextConnection();
}

Expand Down
7 changes: 5 additions & 2 deletions tests/Elasticsearch/Tests/YamlRunnerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ public function testAsyncIntegration($testProcedure, $skip, $setupProcedure, $fi
}

if (null !== $setupProcedure) {
$this->processProcedure(current($setupProcedure), 'setup');
$this->processProcedure(current($setupProcedure), 'setup', $fileName);
$this->waitForYellow();
}

Expand Down Expand Up @@ -326,6 +326,9 @@ public function operationDo($operation, $lastOperationResult, &$context, $testNa
$endpointParams->client['headers'] = $headers;
}

if (!is_string($method)) {
throw new \Exception('$method must be string');
}
list($method, $namespace) = $this->mapEndpoint($method, $namespace);

if (null !== $namespace) {
Expand Down Expand Up @@ -404,7 +407,7 @@ public function executeRequest($caller, $method, $endpointParams, $expectedError
*
* @throws \Exception
*
* @return bool
* @return bool|mixed[]
*/
public function executeAsyncExistRequest($caller, $method, $endpointParams, $expectedError, $expectedWarnings, $testName)
{
Expand Down

0 comments on commit 946cd65

Please sign in to comment.