-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
148 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,5 @@ | |
/.php_cs.cache | ||
.php-cs-fixer.cache | ||
composer.lock | ||
/.phpunit.result.cache | ||
/var |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/8.5/phpunit.xsd" | ||
bootstrap="tests/integration/bootstrap.php" | ||
beStrictAboutOutputDuringTests="true" | ||
beStrictAboutTodoAnnotatedTests="true" | ||
failOnWarning="true" | ||
verbose="true"> | ||
<php> | ||
<env name="KERNEL_CLASS" value="Ibexa\Tests\Integration\Rest\IbexaTestKernel" /> | ||
<env name="SEARCH_ENGINE" value="legacy" /> | ||
<env name="DATABASE_URL" value="sqlite://i@i/var/test.db" /> | ||
<env name="SYMFONY_DEPRECATIONS_HELPER" value="max[self]=4&max[direct]=0&verbose=0"/> | ||
</php> | ||
<testsuites> | ||
<testsuite name="integration"> | ||
<directory>tests/integration</directory> | ||
</testsuite> | ||
</testsuites> | ||
</phpunit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Copyright (C) Ibexa AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Ibexa\Tests\Integration\Rest; | ||
|
||
use Ibexa\Contracts\Core\Repository\Repository; | ||
use Ibexa\Contracts\Test\Core\IbexaKernelTestCase; | ||
use Ibexa\Rest\Server\Controller\Root as RestRootController; | ||
|
||
/** | ||
* @coversNothing | ||
*/ | ||
final class BasicKernelTest extends IbexaKernelTestCase | ||
{ | ||
protected function setUp(): void | ||
{ | ||
self::bootKernel(); | ||
} | ||
|
||
public function testBasicKernelCompiles(): void | ||
{ | ||
$this->getIbexaTestCore()->getServiceByClassName(Repository::class); | ||
$this->getIbexaTestCore()->getServiceByClassName(RestRootController::class); | ||
$this->expectNotToPerformAssertions(); | ||
} | ||
|
||
public function testRouterIsAvailable(): void | ||
{ | ||
$router = self::getContainer()->get('router'); | ||
$router->match('/api/ibexa/v2/'); | ||
$this->expectNotToPerformAssertions(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Copyright (C) Ibexa AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Ibexa\Tests\Integration\Rest; | ||
|
||
use Hautelook\TemplatedUriBundle\HautelookTemplatedUriBundle; | ||
use Ibexa\Bundle\Rest\IbexaRestBundle; | ||
use Ibexa\Contracts\Test\Core\IbexaTestKernel as CoreIbexaTestKernel; | ||
use Ibexa\Rest\Server\Controller\Root as RestRootController; | ||
use Lexik\Bundle\JWTAuthenticationBundle\Services\JWTTokenManagerInterface; | ||
use Symfony\Component\Config\Loader\LoaderInterface; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
|
||
final class IbexaTestKernel extends CoreIbexaTestKernel | ||
{ | ||
public function registerBundles(): iterable | ||
{ | ||
yield from parent::registerBundles(); | ||
|
||
yield new HautelookTemplatedUriBundle(); | ||
yield new IbexaRestBundle(); | ||
} | ||
|
||
public function registerContainerConfiguration(LoaderInterface $loader): void | ||
{ | ||
parent::registerContainerConfiguration($loader); | ||
|
||
$loader->load(static function (ContainerBuilder $container): void { | ||
self::addSyntheticService($container, JWTTokenManagerInterface::class); | ||
|
||
self::loadRouting($container); | ||
}); | ||
} | ||
|
||
protected static function getExposedServicesByClass(): iterable | ||
{ | ||
yield from parent::getExposedServicesByClass(); | ||
yield RestRootController::class; | ||
} | ||
|
||
private static function loadRouting(ContainerBuilder $container): void | ||
{ | ||
$container->loadFromExtension('framework', [ | ||
'router' => [ | ||
'resource' => __DIR__ . '/Resources/test_routing.yaml', | ||
], | ||
]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
test.ibexa.rest: | ||
resource: '@IbexaRestBundle/Resources/config/routing.yml' | ||
prefix: '%ibexa.rest.path_prefix%' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Copyright (C) Ibexa AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
use Ibexa\Tests\Integration\Rest\IbexaTestKernel; | ||
use Symfony\Bundle\FrameworkBundle\Console\Application; | ||
|
||
chdir(dirname(__DIR__, 2)); | ||
|
||
$kernel = new IbexaTestKernel('test', true); | ||
$kernel->boot(); | ||
|
||
$application = new Application($kernel); | ||
$application->setAutoExit(false); | ||
|
||
// Skipping database initialization until really needed by integration tests | ||
|
||
$kernel->shutdown(); |