Skip to content

Commit fdfb0c1

Browse files
committed
[WIP] Refactoring YAML runner test for 8.0
1 parent 24656b9 commit fdfb0c1

File tree

6 files changed

+9
-16
lines changed

6 files changed

+9
-16
lines changed

.ci/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG PHP_VERSION=7.4-cli
1+
ARG PHP_VERSION=8.0-cli
22
FROM php:${PHP_VERSION}
33

44
WORKDIR /usr/src/app

.ci/docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG PHP_VERSION=7.4-cli
1+
ARG PHP_VERSION=8.0-cli
22
FROM php:${PHP_VERSION}
33

44
# Create app directory

phpunit-yaml-platinum-tests.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</php>
1313
<testsuites>
1414
<testsuite name="Yaml tests">
15-
<directory>tests/Elasticsearch/Tests/Yaml/Platinum</directory>
15+
<directory>tests/Yaml/Platinum</directory>
1616
</testsuite>
1717
</testsuites>
1818
<groups>

tests/Utility.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
use Exception;
1818
use Elastic\Elasticsearch\Client;
1919
use Elastic\Elasticsearch\ClientBuilder;
20-
use Elastic\Elasticsearch\Exceptions\ElasticsearchException;
20+
use Elastic\Elasticsearch\Exception\ElasticsearchException;
2121

2222
class Utility
2323
{
@@ -333,7 +333,7 @@ private static function waitForPendingTasks(Client $client, string $filter, int
333333
$result = $client->cat()->tasks([
334334
'detailed' => true
335335
]);
336-
$tasks = explode("\n", $result);
336+
$tasks = explode("\n", $result->asString());
337337
$count = 0;
338338
foreach ($tasks as $task) {
339339
if (empty($task)) {

util/RestSpecRunner.php

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,15 @@
1212
* the GNU Lesser General Public License, Version 2.1, at your option.
1313
* See the LICENSE file in the project root for more information.
1414
*/
15-
16-
1715
declare(strict_types = 1);
1816

1917
use Elastic\Transport\Exception\NoNodeAvailableException;
2018
use Elastic\Elasticsearch\Tests\Utility;
2119

22-
// Set the default timezone. While this doesn't cause any tests to fail, PHP
23-
// complains if it is not set in 'date.timezone' of php.ini.
20+
// Set the default timezone. While this doesn't cause any tests to fail,
21+
// PHP can complains if it is not set in 'date.timezone' of php.ini.
2422
date_default_timezone_set('UTC');
2523

26-
// Ensure that composer has installed all dependencies
27-
if (!file_exists(dirname(__DIR__) . '/composer.lock')) {
28-
die("Dependencies must be installed using composer:\n\nphp composer.phar install --dev\n\n"
29-
. "See http://getcomposer.org for help with installing composer\n");
30-
}
31-
3224
require dirname(__DIR__) . '/vendor/autoload.php';
3325

3426
printf("********************************************************\n");
@@ -46,8 +38,8 @@
4638
printf ("ERROR: Host %s is offline\n", Utility::getHost());
4739
exit(1);
4840
}
49-
5041
$version = $serverInfo['version']['number'];
42+
5143
$artifactFile = sprintf("rest-resources-zip-%s.zip", $version);
5244
$tempFilePath = sprintf("%s/%s.zip", sys_get_temp_dir(), $serverInfo['version']['build_hash']);
5345

util/YamlTests.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ private function getAllTests(string $dir): array
131131
// Iterate over the Yaml test files
132132
foreach (new RecursiveIteratorIterator($it) as $file) {
133133
if ($file->getExtension() === 'yml') {
134+
printf ("Parsing file %s\n", $file->getPathname());
134135
$test = yaml_parse_file($file->getPathname(), -1, $ndocs, [
135136
YAML_MAP_TAG => function($value, $tag, $flags) {
136137
return empty($value) ? new stdClass : $value;

0 commit comments

Comments
 (0)