-
Notifications
You must be signed in to change notification settings - Fork 0
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
14 changed files
with
158 additions
and
64 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,28 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd" | ||
backupGlobals="false" | ||
colors="true" | ||
verbose="true" | ||
bootstrap="./vendor/autoload.php" | ||
> | ||
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd" | ||
bootstrap="tests/bootstrap.php" | ||
colors="true" > | ||
|
||
<php> | ||
<ini name="display_errors" value="1" /> | ||
<ini name="error_reporting" value="-1" /> | ||
<server name="KERNEL_CLASS" value="Odandb\XhprofBundle\Tests\Fixtures\Kernel" /> | ||
<server name="APP_ENV" value="test" force="true" /> | ||
<server name="APP_DEBUG" value="false" /> | ||
<server name="SHELL_VERBOSITY" value="-1" /> | ||
<server name="SYMFONY_PHPUNIT_REMOVE" value="" /> | ||
<server name="SYMFONY_DEPRECATIONS_HELPER" value="999999" /> | ||
<server name="SYMFONY_PHPUNIT_VERSION" value="9.5" /> | ||
<env name="BOOTSTRAP_CLEAR_CACHE_ENV" value="true"/> | ||
</php> | ||
|
||
<testsuites> | ||
<testsuite name="Project Test Suite"> | ||
<directory>tests</directory> | ||
<testsuite name="XhprofBundle test suite"> | ||
<directory>tests/Functional</directory> | ||
</testsuite> | ||
</testsuites> | ||
|
||
<coverage processUncoveredFiles="true"> | ||
<source> | ||
<include> | ||
<directory>./src/</directory> | ||
<directory>src</directory> | ||
</include> | ||
</coverage> | ||
</source> | ||
</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
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
/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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Odandb\XhprofBundle\Tests\Fixtures\Controller; | ||
|
||
use Symfony\Component\HttpFoundation\JsonResponse; | ||
|
||
class TestController | ||
{ | ||
public function profile(): JsonResponse | ||
{ | ||
return new JsonResponse(); | ||
} | ||
} |
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,29 @@ | ||
<?php | ||
|
||
namespace Odandb\XhprofBundle\Tests\Fixtures; | ||
|
||
use Odandb\XhprofBundle\OdandbXhprofBundle; | ||
use Symfony\Bundle\FrameworkBundle\FrameworkBundle; | ||
use Symfony\Component\Config\Loader\LoaderInterface; | ||
use Symfony\Component\HttpKernel\Kernel as BaseKernel; | ||
|
||
class Kernel extends BaseKernel | ||
{ | ||
public function registerBundles(): iterable | ||
{ | ||
return [ | ||
new FrameworkBundle(), | ||
new OdandbXhprofBundle(), | ||
]; | ||
} | ||
|
||
public function registerContainerConfiguration(LoaderInterface $loader) | ||
{ | ||
$loader->load(__DIR__ . '/config.yaml'); | ||
} | ||
|
||
public function getProjectDir(): string | ||
{ | ||
return __DIR__; | ||
} | ||
} |
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,13 @@ | ||
imports: | ||
- { resource: services.yaml } | ||
|
||
framework: | ||
secret: '123456789' | ||
http_method_override: false | ||
router: | ||
utf8: true | ||
resource: '%kernel.project_dir%/routing.yaml' | ||
strict_requirements: ~ | ||
test: ~ | ||
profiler: | ||
collect: false |
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 @@ | ||
<?php | ||
|
||
// Configuration for the profiler to send data to XHGui. | ||
// Set the callable of "profiler.enable" to return false in order to disable the profiler. | ||
return [ | ||
'profiler.enable' => function() { | ||
return false; | ||
}, | ||
|
||
'save.handler' => 'file', | ||
'save.handler.file' => array( | ||
'filename' => 'var/xhgui/data.jsonl', | ||
), | ||
'profiler.simple_url' => null, | ||
'profiler.options' => [], | ||
'date.format' => 'M jS H:i:s', | ||
'detail.count' => 6, | ||
'page.limit' => 25, | ||
]; |
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 @@ | ||
person_list: | ||
path: /profile | ||
controller: Odandb\XhprofBundle\Tests\Fixtures\Controller\TestController::profile |
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,8 @@ | ||
services: | ||
_defaults: | ||
autowire: true | ||
autoconfigure: true | ||
|
||
Odandb\XhprofBundle\Tests\Fixtures\Controller\: | ||
resource: 'Controller' | ||
tags: ['controller.service_arguments'] |
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,43 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
|
||
namespace Odandb\XhprofBundle\Tests\Functional; | ||
|
||
|
||
use Odandb\XhprofBundle\EventSubscriber\KernelEventSubscriber; | ||
use Symfony\Bundle\FrameworkBundle\KernelBrowser; | ||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; | ||
use Symfony\Component\DependencyInjection\ContainerInterface; | ||
|
||
/** | ||
* This is a functional test to check if the service wiring is correct. | ||
* It is based on https://symfonycasts.com/screencast/symfony-bundle. | ||
*/ | ||
class FunctionalTest extends WebTestCase | ||
{ | ||
protected ?KernelBrowser $client; | ||
|
||
protected ?ContainerInterface $container; | ||
|
||
protected function setUp() : void | ||
{ | ||
$this->client = self::createClient(); | ||
|
||
$this->container = $this->client->getContainer(); | ||
} | ||
|
||
public function testServiceWiring() | ||
{ | ||
$service = $this->container->get(KernelEventSubscriber::class); | ||
self::assertInstanceOf(KernelEventSubscriber::class, $service); | ||
} | ||
|
||
public function testProfile() | ||
{ | ||
$this->client->request('GET', '/profile'); | ||
|
||
self::assertResponseIsSuccessful(); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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,13 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use Symfony\Component\ErrorHandler\ErrorHandler; | ||
|
||
require __DIR__ . '/../vendor/autoload.php'; | ||
|
||
set_exception_handler([new ErrorHandler(), 'handleException']); | ||
|
||
// Clean up from previous runs | ||
@exec('rm -rf ' . escapeshellarg(__DIR__ . '/Fixtures/var')); | ||
@exec('mkdir -p ' . escapeshellarg(__DIR__ . '/Fixtures/var/xhgui')); |