This repository has been archived by the owner on Sep 18, 2022. It is now read-only.
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
5 changed files
with
135 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
/* | ||
* (c) Christian Gripp <mail@core23.de> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Core23\SitemapBundle\Tests\Action; | ||
|
||
use Core23\SitemapBundle\Tests\App\AppKernel; | ||
use PHPUnit\Framework\TestCase; | ||
use Symfony\Bundle\FrameworkBundle\KernelBrowser; | ||
|
||
final class SitemapXMLActionIntegrationTest extends TestCase | ||
{ | ||
public function testSitemapXml(): void | ||
{ | ||
$client = new KernelBrowser(new AppKernel()); | ||
$client->request('GET', '/sitemap.xml'); | ||
|
||
static::assertSame(200, $client->getResponse()->getStatusCode()); | ||
} | ||
} |
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,68 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* (c) Christian Gripp <mail@core23.de> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Core23\SitemapBundle\Tests\App; | ||
|
||
use Core23\SitemapBundle\Core23SitemapBundle; | ||
use Symfony\Bundle\FrameworkBundle\FrameworkBundle; | ||
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; | ||
use Symfony\Component\Config\Loader\LoaderInterface; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\HttpKernel\Kernel; | ||
use Symfony\Component\Routing\RouteCollectionBuilder; | ||
|
||
final class AppKernel extends Kernel | ||
{ | ||
use MicroKernelTrait; | ||
|
||
public function __construct() | ||
{ | ||
parent::__construct('test', false); | ||
} | ||
|
||
public function registerBundles() | ||
{ | ||
return [ | ||
new FrameworkBundle(), | ||
new Core23SitemapBundle(), | ||
]; | ||
} | ||
|
||
public function getCacheDir(): string | ||
{ | ||
return $this->getBaseDir().'cache'; | ||
} | ||
|
||
public function getLogDir(): string | ||
{ | ||
return $this->getBaseDir().'log'; | ||
} | ||
|
||
public function getProjectDir(): string | ||
{ | ||
return __DIR__; | ||
} | ||
|
||
protected function configureRoutes(RouteCollectionBuilder $routes): void | ||
{ | ||
$routes->import(__DIR__.'/../../src/Resources/config/routing/sitemap.yml'); | ||
} | ||
|
||
protected function configureContainer(ContainerBuilder $containerBuilder, LoaderInterface $loader): void | ||
{ | ||
$loader->load(__DIR__.'/config/config.yaml'); | ||
} | ||
|
||
private function getBaseDir(): string | ||
{ | ||
return sys_get_temp_dir().'/app-bundle/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,29 @@ | ||
<?php | ||
|
||
/* | ||
* (c) Christian Gripp <mail@core23.de> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Core23\SitemapBundle\Tests\App\Sitemap; | ||
|
||
use Core23\SitemapBundle\Definition\SitemapDefinitionInterface; | ||
use Core23\SitemapBundle\Model\Url; | ||
use Core23\SitemapBundle\Sitemap\SitemapServiceInterface; | ||
use Symfony\Component\OptionsResolver\OptionsResolver; | ||
|
||
final class DemoSitemap implements SitemapServiceInterface | ||
{ | ||
public function configureSettings(OptionsResolver $resolver): void | ||
{ | ||
} | ||
|
||
public function execute(SitemapDefinitionInterface $sitemap): array | ||
{ | ||
return [ | ||
new Url('example.com'), | ||
]; | ||
} | ||
} |
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,11 @@ | ||
framework: | ||
secret: secret | ||
|
||
services: | ||
_defaults: | ||
autowire: true | ||
autoconfigure: true | ||
|
||
Core23\SitemapBundle\Tests\App\Sitemap\DemoSitemap: | ||
tags: ['core23.sitemap'] | ||
|