Skip to content

Commit

Permalink
test page scanner command and controller
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinDev committed Jan 11, 2021
1 parent d5b273f commit b010f59
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yml
Expand Up @@ -10,7 +10,7 @@ jobs:
matrix:
os: [ubuntu-latest, windows-latest]
php: [7.4]
stability: [prefer-lowest, prefer-stable]
stability: [prefer-stable] #prefer-lowest,

name: P${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.os }}

Expand Down
24 changes: 24 additions & 0 deletions packages/page-scanner/tests/PageScannerCommandTest.php
@@ -0,0 +1,24 @@
<?php

namespace Pushword\PageScanner\Tests;

use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\Console\Tester\CommandTester;

class PageScannerCommandTest extends KernelTestCase
{
public function testExecute()
{
$kernel = static::createKernel();
$application = new Application($kernel);

$command = $application->find('pushword:page:scan');
$commandTester = new CommandTester($command);
$commandTester->execute(['localhost.dev']);

// the output of the command in the console
$output = $commandTester->getDisplay();
$this->assertTrue(false !== strpos($output, 'done...'));
}
}
18 changes: 18 additions & 0 deletions packages/page-scanner/tests/PageScannerControllerTest.php
@@ -0,0 +1,18 @@
<?php

namespace Pushword\TemplateEditor\Tests;

use Pushword\Admin\Tests\AbstractAdminTest;

class PageScannerControllerTest extends AbstractAdminTest
{
public function testAdmin()
{
$client = $this->loginUser();

$client->catchExceptions(false);

$client->request('GET', '/admin/page/scan');
$this->assertResponseIsSuccessful();
}
}
@@ -0,0 +1 @@
a:1:{i:1;a:1:{i:0;a:2:{s:7:"message";s:32:"<code>/admin/</code> introuvable";s:4:"page";a:5:{s:2:"id";i:1;s:4:"slug";s:8:"homepage";s:2:"h1";s:33:"Welcome : this is your first page";s:10:"metaRobots";N;s:4:"host";N;}}}}

0 comments on commit b010f59

Please sign in to comment.