-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from Abhoryo/testing
- Loading branch information
Showing
27 changed files
with
245 additions
and
60 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
|
||
jobs: | ||
test: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
strategy: | ||
max-parallel: 10 | ||
matrix: | ||
php: ['7.2', '7.3', '7.4'] | ||
|
||
steps: | ||
- name: Set up PHP | ||
uses: shivammathur/[email protected] | ||
with: | ||
php-version: ${{ matrix.php }} | ||
coverage: xdebug | ||
ini-values: xdebug.overload_var_dump=1 | ||
extensions: mbstring, intl | ||
tools: prestissimo | ||
|
||
- name: Setup Problem Matchers for PHPUnit | ||
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Run tests | ||
run: make test | ||
|
||
test-lowest: | ||
name: Test Lowest | ||
runs-on: ubuntu-latest | ||
strategy: | ||
max-parallel: 10 | ||
matrix: | ||
php: ['7.2', '7.3', '7.4'] | ||
|
||
steps: | ||
- name: Set up PHP | ||
uses: shivammathur/[email protected] | ||
with: | ||
php-version: ${{ matrix.php }} | ||
coverage: xdebug | ||
ini-values: xdebug.overload_var_dump=1 | ||
extensions: mbstring, intl | ||
tools: prestissimo | ||
|
||
- name: Setup Problem Matchers for PHPUnit | ||
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Run tests | ||
run: make test-lowest |
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,6 @@ | ||
test: | ||
composer update --prefer-dist --no-interaction ${COMPOSER_PARAMS} | ||
composer test | ||
|
||
test-lowest: | ||
COMPOSER_PARAMS='--prefer-lowest' $(MAKE) test |
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 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
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,32 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/6.0/phpunit.xsd" | ||
backupGlobals="false" | ||
colors="true" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
bootstrap="./vendor/autoload.php" | ||
> | ||
<php> | ||
<ini name="error_reporting" value="-1" /> | ||
<ini name="intl.default_locale" value="en" /> | ||
<ini name="intl.error_level" value="0" /> | ||
<ini name="memory_limit" value="-1" /> | ||
<env name="SYMFONY_DEPRECATIONS_HELPER" value="max[self]=0" /> | ||
<env name="SYMFONY_PHPUNIT_REMOVE_RETURN_TYPEHINT " value="1" /> | ||
</php> | ||
|
||
<testsuites> | ||
<testsuite name="Test suite"> | ||
<directory suffix="Test.php">./tests</directory> | ||
</testsuite> | ||
</testsuites> | ||
|
||
<filter> | ||
<whitelist> | ||
<directory suffix=".php">./src/</directory> | ||
</whitelist> | ||
</filter> | ||
</phpunit> |
File renamed without changes.
File renamed without changes.
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
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.
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,21 @@ | ||
<?xml version="1.0" ?> | ||
<container xmlns="http://symfony.com/schema/dic/services" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd"> | ||
|
||
<services> | ||
<defaults public="false" autoconfigure="true" autowire="true" /> | ||
|
||
<prototype namespace="APY\BreadcrumbTrailBundle\" resource="../../*" exclude="../../{Annotation,Resources}"/> | ||
|
||
<service id="apy_breadcrumb_trail" class="APY\BreadcrumbTrailBundle\BreadcrumbTrail\Trail" public="true"> | ||
<call method="setTemplate"> | ||
<argument>%apy_breadcrumb_trail.template%</argument> | ||
</call> | ||
</service> | ||
|
||
<service id="apy_breadcrumb_trail.annotation.listener" class="APY\BreadcrumbTrailBundle\EventListener\BreadcrumbListener"> | ||
<tag name="kernel.event_listener" event="kernel.controller" method="onKernelController" priority="-1" /> | ||
</service> | ||
</services> | ||
</container> |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,22 @@ | ||
<?php | ||
|
||
namespace APY\BreadcrumbTrailBundle; | ||
|
||
use Nyholm\BundleTest\BaseBundleTestCase; | ||
|
||
class BundleInitializationTest extends BaseBundleTestCase | ||
{ | ||
protected function getBundleClass() | ||
{ | ||
return APYBreadcrumbTrailBundle::class; | ||
} | ||
|
||
public function testServicesAreRegistrated() | ||
{ | ||
$this->bootKernel(); | ||
$container = $this->getContainer(); | ||
|
||
$this->assertTrue($container->has('apy_breadcrumb_trail')); | ||
$this->assertTrue($container->hasParameter('apy_breadcrumb_trail.template')); | ||
} | ||
} |
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,27 @@ | ||
<?php | ||
|
||
namespace APY\BreadcrumbTrailBundle; | ||
|
||
use APY\BreadcrumbTrailBundle\BreadcrumbTrail\Trail; | ||
use APY\BreadcrumbTrailBundle\DependencyInjection\APYBreadcrumbTrailExtension; | ||
use APY\BreadcrumbTrailBundle\EventListener\BreadcrumbListener; | ||
use APY\BreadcrumbTrailBundle\Twig\BreadcrumbTrailExtension; | ||
use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractExtensionTestCase; | ||
|
||
class ExtensionTest extends AbstractExtensionTestCase | ||
{ | ||
protected function getContainerExtensions(): array | ||
{ | ||
return [ | ||
new APYBreadcrumbTrailExtension() | ||
]; | ||
} | ||
|
||
public function testContainerHasExtension() | ||
{ | ||
$this->load(); | ||
$this->assertContainerBuilderHasService(Trail::class); | ||
$this->assertContainerBuilderHasService(BreadcrumbListener::class); | ||
$this->assertContainerBuilderHasService(BreadcrumbTrailExtension::class); | ||
} | ||
} |
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,41 @@ | ||
<?php | ||
|
||
namespace APY\BreadcrumbTrailBundle\Twig; | ||
|
||
use APY\BreadcrumbTrailBundle\APYBreadcrumbTrailBundle; | ||
use Nyholm\BundleTest\BaseBundleTestCase; | ||
use Nyholm\BundleTest\CompilerPass\PublicServicePass; | ||
use Symfony\Bundle\TwigBundle\TwigBundle; | ||
use Twig\Environment; | ||
|
||
/** | ||
* @coversDefaultClass \APY\BreadcrumbTrailBundle\Twig\BreadcrumbTrailExtension | ||
*/ | ||
class BreadcrumbTrailExtensionTest extends BaseBundleTestCase | ||
{ | ||
protected function getBundleClass() | ||
{ | ||
return APYBreadcrumbTrailBundle::class; | ||
} | ||
|
||
protected function setUp(): void | ||
{ | ||
$this->addCompilerPass(new PublicServicePass('|twig|')); | ||
|
||
$kernel = $this->createKernel(); | ||
$kernel->addBundle(TwigBundle::class); | ||
$kernel->boot(); | ||
} | ||
|
||
public function testTwigFunctionGetsRegistered() | ||
{ | ||
$container = $this->getContainer(); | ||
|
||
/** @var Environment $twig */ | ||
$twig = $container->get('twig'); | ||
|
||
self::assertNotNull( | ||
$twig->getFunction('apy_breadcrumb_trail_render') | ||
); | ||
} | ||
} |