Skip to content

Commit d9ebdf2

Browse files
committed
Skip test if class doesn't exist
1 parent df080de commit d9ebdf2

3 files changed

Lines changed: 23 additions & 0 deletions

File tree

behat.yml.dist

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ default:
1313
- 'ApiPlatform\Core\Tests\Behat\JsonHalContext'
1414
- 'ApiPlatform\Core\Tests\Behat\MercureContext'
1515
- 'ApiPlatform\Core\Tests\Behat\XmlContext'
16+
- 'ApiPlatform\Core\Tests\Behat\SystemContext'
1617
- 'Behat\MinkExtension\Context\MinkContext'
1718
- 'behatch:context:rest'
1819
filters:
@@ -49,6 +50,7 @@ postgres:
4950
- 'ApiPlatform\Core\Tests\Behat\JsonHalContext'
5051
- 'ApiPlatform\Core\Tests\Behat\MercureContext'
5152
- 'ApiPlatform\Core\Tests\Behat\XmlContext'
53+
- 'ApiPlatform\Core\Tests\Behat\SystemContext'
5254
- 'Behat\MinkExtension\Context\MinkContext'
5355
- 'behatch:context:rest'
5456
filters:
@@ -70,6 +72,7 @@ mongodb:
7072
- 'ApiPlatform\Core\Tests\Behat\JsonHalContext'
7173
- 'ApiPlatform\Core\Tests\Behat\MercureContext'
7274
- 'ApiPlatform\Core\Tests\Behat\XmlContext'
75+
- 'ApiPlatform\Core\Tests\Behat\SystemContext'
7376
- 'Behat\MinkExtension\Context\MinkContext'
7477
- 'behatch:context:rest'
7578
filters:
@@ -107,6 +110,7 @@ default-coverage:
107110
- 'ApiPlatform\Core\Tests\Behat\MercureContext'
108111
- 'ApiPlatform\Core\Tests\Behat\CoverageContext'
109112
- 'ApiPlatform\Core\Tests\Behat\XmlContext'
113+
- 'ApiPlatform\Core\Tests\Behat\SystemContext'
110114
- 'Behat\MinkExtension\Context\MinkContext'
111115
- 'behatch:context:rest'
112116

@@ -128,6 +132,7 @@ mongodb-coverage:
128132
- 'ApiPlatform\Core\Tests\Behat\MercureContext'
129133
- 'ApiPlatform\Core\Tests\Behat\CoverageContext'
130134
- 'ApiPlatform\Core\Tests\Behat\XmlContext'
135+
- 'ApiPlatform\Core\Tests\Behat\SystemContext'
131136
- 'Behat\MinkExtension\Context\MinkContext'
132137
- 'behatch:context:rest'
133138

features/hydra/collection.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,7 @@ Feature: Collections support
562562
@createSchema
563563
Scenario: Cursor-based pagination with ranged items on uids
564564
Given there are 10 of these so many uid objects
565+
And class "Ramsey\Uuid\Nonstandard\UuidV6" exists
565566
When I send a "GET" request to "/so_many_uids?order%5Bid%5D=desc&id%5Blt%5D=1ec5c128-f3d4-62d0-b528-68fef707f0bd"
566567
Then the response status code should be 200
567568
And the response should be in JSON

tests/Core/Behat/SystemContext.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
namespace ApiPlatform\Core\Tests\Behat;
4+
5+
use Behat\Behat\Context\Context;
6+
use Behat\Behat\Tester\Exception\PendingException;
7+
8+
class SystemContext implements Context
9+
{
10+
/** @Given class :clazz exists */
11+
public function classExists($clazz)
12+
{
13+
if (!class_exists($clazz)) {
14+
throw new PendingException(sprintf('Class %s is not defined, skipping test', $clazz));
15+
}
16+
}
17+
}

0 commit comments

Comments
 (0)