Add unit tests

This commit is contained in:
Daniel Siepmann 2020-09-23 08:42:34 +02:00
parent e967112277
commit d123d5219e
Signed by: Daniel Siepmann
GPG key ID: 33D6629915560EF4
12 changed files with 848 additions and 24 deletions

View file

@ -109,6 +109,42 @@ jobs:
- name: TYPO3 language files
run: xmllint --schema .Build/xliff-core-1.2-strict.xsd --noout $(find Resources -name '*.xlf')
tests:
runs-on: ubuntu-latest
needs:
- check-dependencies
- xml-linting
strategy:
matrix:
php-version:
- 7.3
- 7.4
steps:
- uses: actions/checkout@v2
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: "${{ matrix.php-version }}"
- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest
- name: PHPUnit Tests
run: ./vendor/bin/phpunit --testdox
code-quality:
runs-on: ubuntu-latest
needs: [check-dependencies]

View file

@ -22,31 +22,10 @@ namespace SkillDisplay\Typo3Extension;
*/
use SkillDisplay\PHPToolKit\Configuration\Settings;
use TYPO3\CMS\Core\Context\Context;
use TYPO3\CMS\Core\Http\ServerRequest;
use TYPO3\CMS\Core\Site\SiteFinder;
class SettingsFactory
{
/**
* @var SiteFinder
*/
private $siteFinder;
/**
* @var Context
*/
private $context;
public function __construct(
SiteFinder $siteFinder,
Context $context
) {
$this->siteFinder = $siteFinder;
$this->context = $context;
}
public function createFromCurrentSiteConfiguration(): Settings
{
$site = $this->getRequest()->getAttribute('site');
@ -58,7 +37,7 @@ class SettingsFactory
return new Settings(
$config['skilldisplay_api_key'] ?? '',
((int)$config['skilldisplay_verifier_id']) ?? 0,
(int)($config['skilldisplay_verifier_id'] ?? 0),
$config['skilldisplay_user_secret'] ?? ''
);
}

View file

@ -0,0 +1,194 @@
<?php
namespace SkillDisplay\Typo3Extension\Tests\Unit\Backend;
/*
* Copyright (C) 2020 Daniel Siepmann <coding@daniel-siepmann.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use SkillDisplay\PHPToolKit\Api\Skill;
use SkillDisplay\PHPToolKit\Api\SkillSet;
use SkillDisplay\PHPToolKit\Entity\Skill as SkillEntity;
use SkillDisplay\PHPToolKit\Entity\SkillSet as SkillSetEntity;
use SkillDisplay\Typo3Extension\Backend\Preview;
use TYPO3\CMS\Backend\View\PageLayoutView;
/**
* @covers SkillDisplay\Typo3Extension\Backend\Preview
*/
class PreviewTest extends TestCase
{
use ProphecyTrait;
/**
* @test
*/
public function instanceCanBeCreated(): void
{
$skillApi = $this->prophesize(Skill::class);
$skillSetApi = $this->prophesize(SkillSet::class);
$subject = new Preview(
$skillApi->reveal(),
$skillSetApi->reveal()
);
static::assertInstanceOf(Preview::class, $subject);
}
/**
* @test
*/
public function doesReturnEmptyResultsIfNoIds(): void
{
$skillApi = $this->prophesize(Skill::class);
$skillSetApi = $this->prophesize(SkillSet::class);
$pageLayoutView = $this->prophesize(PageLayoutView::class);
$subject = new Preview(
$skillApi->reveal(),
$skillSetApi->reveal()
);
$revealedPageLayoutView = $pageLayoutView->reveal();
$drawItem = false;
$headerContent = '';
$itemContent = '';
$row = [
'skilldisplay_skills' => '',
'skilldisplay_skillset' => '0',
];
$subject->preProcess(
$revealedPageLayoutView,
$drawItem,
$headerContent,
$itemContent,
$row
);
static::assertFalse($drawItem);
static::assertEmpty($headerContent);
static::assertEmpty($itemContent);
static::assertSame([
'skilldisplay_skills' => '',
'skilldisplay_skillset' => '0',
'skills' => [],
'skillSets' => [],
], $row);
}
/**
* @test
*/
public function addsSkillsBasedOnIds(): void
{
$skillApi = $this->prophesize(Skill::class);
$skillSetApi = $this->prophesize(SkillSet::class);
$pageLayoutView = $this->prophesize(PageLayoutView::class);
$skill10 = $this->prophesize(SkillEntity::class);
$skillApi->getById(10)->willReturn($skill10->reveal());
$skill20 = $this->prophesize(SkillEntity::class);
$skillApi->getById(20)->willReturn($skill20->reveal());
$subject = new Preview(
$skillApi->reveal(),
$skillSetApi->reveal()
);
$revealedPageLayoutView = $pageLayoutView->reveal();
$drawItem = false;
$headerContent = '';
$itemContent = '';
$row = [
'skilldisplay_skills' => '10, 20,,',
'skilldisplay_skillset' => '0',
];
$subject->preProcess(
$revealedPageLayoutView,
$drawItem,
$headerContent,
$itemContent,
$row
);
static::assertFalse($drawItem);
static::assertEmpty($headerContent);
static::assertEmpty($itemContent);
static::assertSame([
'skilldisplay_skills' => '10, 20,,',
'skilldisplay_skillset' => '0',
'skills' => [
$skill10->reveal(),
$skill20->reveal(),
],
'skillSets' => [],
], $row);
}
/**
* @test
*/
public function addsSkillSetsBasedOnIds(): void
{
$skillApi = $this->prophesize(Skill::class);
$skillSetApi = $this->prophesize(SkillSet::class);
$pageLayoutView = $this->prophesize(PageLayoutView::class);
$skillSet10 = $this->prophesize(SkillSetEntity::class);
$skillSetApi->getById(10)->willReturn($skillSet10->reveal());
$subject = new Preview(
$skillApi->reveal(),
$skillSetApi->reveal()
);
$revealedPageLayoutView = $pageLayoutView->reveal();
$drawItem = false;
$headerContent = '';
$itemContent = '';
$row = [
'skilldisplay_skills' => '',
'skilldisplay_skillset' => '10',
];
$subject->preProcess(
$revealedPageLayoutView,
$drawItem,
$headerContent,
$itemContent,
$row
);
static::assertFalse($drawItem);
static::assertEmpty($headerContent);
static::assertEmpty($itemContent);
static::assertSame([
'skilldisplay_skills' => '',
'skilldisplay_skillset' => '10',
'skills' => [],
'skillSets' => [
$skillSet10->reveal(),
],
], $row);
}
}

View file

@ -0,0 +1,112 @@
<?php
namespace SkillDisplay\Typo3Extension\Tests\Unit\Frontend\DataProcessing;
/*
* Copyright (C) 2020 Daniel Siepmann <coding@daniel-siepmann.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use SkillDisplay\PHPToolKit\Api\SkillSet;
use SkillDisplay\PHPToolKit\Entity\SkillSet as SkillSetEntity;
use SkillDisplay\Typo3Extension\Frontend\DataProcessing\SkillSets;
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
/**
* @covers SkillDisplay\Typo3Extension\Frontend\DataProcessing\SkillSets
*/
class SkillSetsTest extends TestCase
{
use ProphecyTrait;
/**
* @test
*/
public function instanceCanBeCreated(): void
{
$skillApi = $this->prophesize(SkillSet::class);
$subject = new SkillSets(
$skillApi->reveal()
);
static::assertInstanceOf(SkillSets::class, $subject);
}
/**
* @test
*/
public function addsEmptyArrayIfNoSkillSetsAreProvided(): void
{
$skillApi = $this->prophesize(SkillSet::class);
$cObj = $this->prophesize(ContentObjectRenderer::class);
$cObj->stdWrapValue('as', [], 'skillSets')->willReturn('skillSets');
$cObj->stdWrapValue('skillSets', [], '')->willReturn('');
$subject = new SkillSets(
$skillApi->reveal()
);
$processedData = $subject->process(
$cObj->reveal(),
[],
[],
[]
);
static::assertEquals([
'skillSets' => [],
], $processedData);
}
/**
* @test
*/
public function addsSkillSetsAccordinglyToProvidedIds(): void
{
$skillApi = $this->prophesize(SkillSet::class);
$skillSet10 = $this->prophesize(SkillSetEntity::class);
$skillApi->getById(10)->willReturn($skillSet10->reveal());
$skillSet20 = $this->prophesize(SkillSetEntity::class);
$skillApi->getById(20)->willReturn($skillSet20->reveal());
$cObj = $this->prophesize(ContentObjectRenderer::class);
$cObj->stdWrapValue('as', [], 'skillSets')->willReturn('skillSets');
$cObj->stdWrapValue('skillSets', [], '')->willReturn('10, 20,,');
$subject = new SkillSets(
$skillApi->reveal()
);
$processedData = $subject->process(
$cObj->reveal(),
[],
[],
[
'skillSets' => '10, 20,,',
]
);
static::assertEquals([
'skillSets' => [
$skillSet10->reveal(),
$skillSet20->reveal(),
],
], $processedData);
}
}

View file

@ -0,0 +1,112 @@
<?php
namespace SkillDisplay\Typo3Extension\Tests\Unit\Frontend\DataProcessing;
/*
* Copyright (C) 2020 Daniel Siepmann <coding@daniel-siepmann.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use SkillDisplay\PHPToolKit\Api\Skill;
use SkillDisplay\PHPToolKit\Entity\Skill as SkillEntity;
use SkillDisplay\Typo3Extension\Frontend\DataProcessing\Skills;
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
/**
* @covers SkillDisplay\Typo3Extension\Frontend\DataProcessing\Skills
*/
class SkillsTest extends TestCase
{
use ProphecyTrait;
/**
* @test
*/
public function instanceCanBeCreated(): void
{
$skillApi = $this->prophesize(Skill::class);
$subject = new Skills(
$skillApi->reveal()
);
static::assertInstanceOf(Skills::class, $subject);
}
/**
* @test
*/
public function addsEmptyArrayIfNoSkillsAreProvided(): void
{
$skillApi = $this->prophesize(Skill::class);
$cObj = $this->prophesize(ContentObjectRenderer::class);
$cObj->stdWrapValue('as', [], 'skills')->willReturn('skills');
$cObj->stdWrapValue('skills', [], '')->willReturn('');
$subject = new Skills(
$skillApi->reveal()
);
$processedData = $subject->process(
$cObj->reveal(),
[],
[],
[]
);
static::assertEquals([
'skills' => [],
], $processedData);
}
/**
* @test
*/
public function addsSkillsAccordinglyToProvidedIds(): void
{
$skillApi = $this->prophesize(Skill::class);
$skill10 = $this->prophesize(SkillEntity::class);
$skillApi->getById(10)->willReturn($skill10->reveal());
$skill20 = $this->prophesize(SkillEntity::class);
$skillApi->getById(20)->willReturn($skill20->reveal());
$cObj = $this->prophesize(ContentObjectRenderer::class);
$cObj->stdWrapValue('as', [], 'skills')->willReturn('skills');
$cObj->stdWrapValue('skills', [], '')->willReturn('10, 20,,');
$subject = new Skills(
$skillApi->reveal()
);
$processedData = $subject->process(
$cObj->reveal(),
[],
[],
[
'skills' => '10, 20,,',
]
);
static::assertEquals([
'skills' => [
$skill10->reveal(),
$skill20->reveal(),
],
], $processedData);
}
}

View file

@ -0,0 +1,112 @@
<?php
namespace SkillDisplay\Typo3Extension\Tests\Unit;
/*
* Copyright (C) 2020 Daniel Siepmann <coding@daniel-siepmann.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use SkillDisplay\PHPToolKit\Configuration\Settings;
use SkillDisplay\Typo3Extension\SettingsFactory;
use TYPO3\CMS\Core\Http\ServerRequest;
use TYPO3\CMS\Core\Site\Entity\Site;
/**
* @covers SkillDisplay\Typo3Extension\SettingsFactory
*/
class SettingsFactoryTest extends TestCase
{
use ProphecyTrait;
/**
* @test
*/
public function instanceCanBeCreated(): void
{
$subject = new SettingsFactory();
static::assertInstanceOf(SettingsFactory::class, $subject);
}
/**
* @test
*/
public function returnsDefaultSettingsIfNothingIsConfigured(): void
{
$site = $this->prophesize(Site::class);
$site->getConfiguration()->willReturn([]);
$request = $this->prophesize(ServerRequest::class);
$request->getAttribute('site')->willReturn($site->reveal());
$GLOBALS['TYPO3_REQUEST'] = $request->reveal();
$subject = new SettingsFactory();
$settings = $subject->createFromCurrentSiteConfiguration();
static::assertInstanceOf(Settings::class, $settings);
static::assertSame(0, $settings->getVerifierID());
static::assertSame('', $settings->getUserSecret());
static::assertSame('', $settings->getApiKey());
static::assertSame('https://www.skilldisplay.eu', $settings->getAPIUrl());
static::assertSame('https://my.skilldisplay.eu', $settings->getMySkillDisplayUrl());
}
/**
* @test
*/
public function returnsSettingsFromCurrentSite(): void
{
$site = $this->prophesize(Site::class);
$site->getConfiguration()->willReturn([
'skilldisplay_api_key' => '---YOUR-API-KEY---',
'skilldisplay_verifier_id' => 10,
'skilldisplay_user_secret' => '---USER-SECRET---',
]);
$request = $this->prophesize(ServerRequest::class);
$request->getAttribute('site')->willReturn($site->reveal());
$GLOBALS['TYPO3_REQUEST'] = $request->reveal();
$subject = new SettingsFactory();
$settings = $subject->createFromCurrentSiteConfiguration();
static::assertInstanceOf(Settings::class, $settings);
static::assertSame(10, $settings->getVerifierID());
static::assertSame('---USER-SECRET---', $settings->getUserSecret());
static::assertSame('---YOUR-API-KEY---', $settings->getApiKey());
static::assertSame('https://www.skilldisplay.eu', $settings->getAPIUrl());
static::assertSame('https://my.skilldisplay.eu', $settings->getMySkillDisplayUrl());
}
/**
* @test
*/
public function throwsExceptionIfCurrentSiteCanNotBeFetched(): void
{
$request = $this->prophesize(ServerRequest::class);
$request->getAttribute('site')->willReturn(null);
$GLOBALS['TYPO3_REQUEST'] = $request->reveal();
$subject = new SettingsFactory();
$this->expectExceptionMessage('Could not determine current site.');
$this->expectExceptionCode(1599721652);
$subject->createFromCurrentSiteConfiguration();
}
}

View file

@ -0,0 +1,122 @@
<?php
namespace SkillDisplay\Typo3Extension\Tests\Unit\ViewHelpers\Verification;
/*
* Copyright (C) 2020 Daniel Siepmann <coding@daniel-siepmann.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
use Prophecy\PhpUnit\ProphecyTrait;
use SkillDisplay\PHPToolKit\Verification\Link;
use SkillDisplay\Typo3Extension\ViewHelpers\Verification\ButtonViewHelper;
use PHPUnit\Framework\TestCase;
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* @covers SkillDisplay\Typo3Extension\ViewHelpers\Verification\ButtonViewHelper
* @covers SkillDisplay\Typo3Extension\ViewHelpers\VerificationViewHelper
*/
class ButtonViewHelperTest extends TestCase
{
use ProphecyTrait;
/**
* @test
*/
public function throwsExceptionIfSkillAndSkillSetIsProvided(): void
{
$renderingContext = $this->prophesize(RenderingContextInterface::class);
$this->expectExceptionMessage('Can only handle skill or skillSet not both.');
$this->expectExceptionCode(1600775604);
ButtonViewHelper::renderStatic(
[
'skill' => 10,
'skillSet' => 10,
],
function () {
},
$renderingContext->reveal()
);
}
/**
* @test
*/
public function throwsExceptionIfNeitherSkillNorSkillSetIsProvided(): void
{
$renderingContext = $this->prophesize(RenderingContextInterface::class);
$this->expectExceptionMessage('Either needs skill or skillSet, none given.');
$this->expectExceptionCode(1600775604);
ButtonViewHelper::renderStatic(
[
],
function () {
},
$renderingContext->reveal()
);
}
/**
* @test
*/
public function returnsRenderedButtonForSkill(): void
{
$renderingContext = $this->prophesize(RenderingContextInterface::class);
$link = $this->prophesize(Link::class);
$link->getVerificationButton('self', 10, Link::SKILL)->willReturn('<p>expected HTML</p>');
GeneralUtility::addInstance(Link::class, $link->reveal());
$result = ButtonViewHelper::renderStatic(
[
'skill' => 10,
'type' => 'self',
],
function () {
},
$renderingContext->reveal()
);
static::assertSame('<p>expected HTML</p>', $result);
}
/**
* @test
*/
public function returnsRenderedButtonForSkillSet(): void
{
$renderingContext = $this->prophesize(RenderingContextInterface::class);
$link = $this->prophesize(Link::class);
$link->getVerificationButton('self', 10, Link::SKILL_SET)->willReturn('<p>expected HTML</p>');
GeneralUtility::addInstance(Link::class, $link->reveal());
$result = ButtonViewHelper::renderStatic(
[
'skillSet' => 10,
'type' => 'self',
],
function () {
},
$renderingContext->reveal()
);
static::assertSame('<p>expected HTML</p>', $result);
}
}

View file

@ -0,0 +1,122 @@
<?php
namespace SkillDisplay\Typo3Extension\Tests\Unit\ViewHelpers\Verification;
/*
* Copyright (C) 2020 Daniel Siepmann <coding@daniel-siepmann.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
use Prophecy\PhpUnit\ProphecyTrait;
use SkillDisplay\PHPToolKit\Verification\Link;
use SkillDisplay\Typo3Extension\ViewHelpers\Verification\UrlViewHelper;
use PHPUnit\Framework\TestCase;
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* @covers SkillDisplay\Typo3Extension\ViewHelpers\Verification\UrlViewHelper
* @covers SkillDisplay\Typo3Extension\ViewHelpers\VerificationViewHelper
*/
class UrlViewHelperTest extends TestCase
{
use ProphecyTrait;
/**
* @test
*/
public function throwsExceptionIfSkillAndSkillSetIsProvided(): void
{
$renderingContext = $this->prophesize(RenderingContextInterface::class);
$this->expectExceptionMessage('Can only handle skill or skillSet not both.');
$this->expectExceptionCode(1600775604);
UrlViewHelper::renderStatic(
[
'skill' => 10,
'skillSet' => 10,
],
function () {
},
$renderingContext->reveal()
);
}
/**
* @test
*/
public function throwsExceptionIfNeitherSkillNorSkillSetIsProvided(): void
{
$renderingContext = $this->prophesize(RenderingContextInterface::class);
$this->expectExceptionMessage('Either needs skill or skillSet, none given.');
$this->expectExceptionCode(1600775604);
UrlViewHelper::renderStatic(
[
],
function () {
},
$renderingContext->reveal()
);
}
/**
* @test
*/
public function returnsRenderedUrlForSkill(): void
{
$renderingContext = $this->prophesize(RenderingContextInterface::class);
$link = $this->prophesize(Link::class);
$link->getVerificationLink('self', 10, Link::SKILL)->willReturn('https://example.com/path/to/verification');
GeneralUtility::addInstance(Link::class, $link->reveal());
$result = UrlViewHelper::renderStatic(
[
'skill' => 10,
'type' => 'self',
],
function () {
},
$renderingContext->reveal()
);
static::assertSame('https://example.com/path/to/verification', $result);
}
/**
* @test
*/
public function returnsRenderedUrlForSkillSet(): void
{
$renderingContext = $this->prophesize(RenderingContextInterface::class);
$link = $this->prophesize(Link::class);
$link->getVerificationLink('self', 10, Link::SKILL_SET)->willReturn('https://example.com/path/to/verification');
GeneralUtility::addInstance(Link::class, $link->reveal());
$result = UrlViewHelper::renderStatic(
[
'skillSet' => 10,
'type' => 'self',
],
function () {
},
$renderingContext->reveal()
);
static::assertSame('https://example.com/path/to/verification', $result);
}
}

View file

@ -44,9 +44,11 @@
"phpstan/phpstan": "^0.12.18",
"phpstan/extension-installer": "^1.0",
"maglnet/composer-require-checker": "^2.1",
"phpspec/prophecy-phpunit": "^2.0",
"phpspec/prophecy-phpunit": "^2.0.0",
"saschaegerer/phpstan-typo3": "^0.13.1",
"sensiolabs/security-checker": "^6.0"
"sensiolabs/security-checker": "^6.0",
"typo3/testing-framework": "^6.4",
"jangregor/phpstan-prophecy": "^0.8.0"
},
"minimum-stability": "dev",
"prefer-stable": true,

View file

@ -3,6 +3,7 @@
<description>This project coding standard</description>
<file>Classes/</file>
<file>Tests/</file>
<file>Configuration/</file>
<file>ext_emconf.php</file>
<file>ext_localconf.php</file>

View file

@ -2,6 +2,7 @@ parameters:
level: max
paths:
- Classes
- Tests
- Configuration
- ext_localconf.php
checkMissingIterableValueType: false

31
phpunit.xml.dist Normal file
View file

@ -0,0 +1,31 @@
<?xml version="1.0"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/typo3/testing-framework/Resources/Core/Build/FunctionalTestsBootstrap.php"
colors="true"
convertErrorsToExceptions="true"
convertWarningsToExceptions="true"
forceCoversAnnotation="false"
processIsolation="false"
stopOnError="false"
stopOnFailure="false"
stopOnIncomplete="false"
stopOnSkipped="false"
verbose="false"
>
<testsuites>
<testsuite name="unit">
<directory>Tests/Unit/</directory>
</testsuite>
</testsuites>
<coverage>
<include>
<directory suffix=".php">Classes</directory>
</include>
</coverage>
</phpunit>