mirror of
https://github.com/Karaka-Management/oms-News.git
synced 2026-02-08 21:08:41 +00:00
upgrade phpunit
This commit is contained in:
parent
68f0d5d81d
commit
509337d2b6
|
|
@ -27,10 +27,10 @@ use phpOMS\Utils\TestUtils;
|
|||
trait ApiControllerNewsArticleTrait
|
||||
{
|
||||
/**
|
||||
* @testdox A news article can be created
|
||||
* @covers \Modules\News\Controller\ApiController
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
#[\PHPUnit\Framework\Attributes\TestDox('A news article can be created')]
|
||||
public function testApiNewsCreate() : void
|
||||
{
|
||||
$response = new HttpResponse();
|
||||
|
|
@ -69,8 +69,8 @@ trait ApiControllerNewsArticleTrait
|
|||
|
||||
/**
|
||||
* @covers \Modules\News\Controller\ApiController
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
public function testApiNewsCreateInvalidData() : void
|
||||
{
|
||||
$response = new HttpResponse();
|
||||
|
|
@ -84,10 +84,10 @@ trait ApiControllerNewsArticleTrait
|
|||
}
|
||||
|
||||
/**
|
||||
* @testdox A news article can be returned
|
||||
* @covers \Modules\News\Controller\ApiController
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
#[\PHPUnit\Framework\Attributes\TestDox('A news article can be returned')]
|
||||
public function testApiNewsGet() : void
|
||||
{
|
||||
$response = new HttpResponse();
|
||||
|
|
@ -102,10 +102,10 @@ trait ApiControllerNewsArticleTrait
|
|||
}
|
||||
|
||||
/**
|
||||
* @testdox A news article can be updated
|
||||
* @covers \Modules\News\Controller\ApiController
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
#[\PHPUnit\Framework\Attributes\TestDox('A news article can be updated')]
|
||||
public function testApiNewsUpdate() : void
|
||||
{
|
||||
$response = new HttpResponse();
|
||||
|
|
@ -123,10 +123,10 @@ trait ApiControllerNewsArticleTrait
|
|||
}
|
||||
|
||||
/**
|
||||
* @testdox A news article can be deleted
|
||||
* @covers \Modules\News\Controller\ApiController
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
#[\PHPUnit\Framework\Attributes\TestDox('A news article can be deleted')]
|
||||
public function testApiNewsDelete() : void
|
||||
{
|
||||
$response = new HttpResponse();
|
||||
|
|
|
|||
|
|
@ -29,11 +29,10 @@ use phpOMS\Router\WebRouter;
|
|||
use phpOMS\Utils\TestUtils;
|
||||
|
||||
/**
|
||||
* @testdox Modules\News\tests\Controller\ApiControllerTest: News api controller
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
final class ControllerTest extends \PHPUnit\Framework\TestCase
|
||||
#[\PHPUnit\Framework\Attributes\TestDox('Modules\News\tests\Controller\ApiControllerTest: News api controller')]
|
||||
final class ApiControllerTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
protected $app = null;
|
||||
|
||||
|
|
|
|||
|
|
@ -23,17 +23,14 @@ use phpOMS\Localization\ISO639x1Enum;
|
|||
use phpOMS\Utils\RnG\Text;
|
||||
|
||||
/**
|
||||
* @testdox Modules\News\tests\Models\NewsArticleMapperTest: News article mapper
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\News\Models\NewsArticleMapper::class)]
|
||||
#[\PHPUnit\Framework\Attributes\TestDox('Modules\News\tests\Models\NewsArticleMapperTest: News article mapper')]
|
||||
final class NewsArticleMapperTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @testdox The model can be created and read from the database
|
||||
* @covers \Modules\News\Models\NewsArticleMapper
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
#[\PHPUnit\Framework\Attributes\TestDox('The model can be created and read from the database')]
|
||||
public function testCRUD() : void
|
||||
{
|
||||
$text = new Text();
|
||||
|
|
@ -66,11 +63,9 @@ final class NewsArticleMapperTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals($news->publish->format('Y-m-d'), $newsR->publish->format('Y-m-d'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @group volume
|
||||
* @group module
|
||||
* @coversNothing
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('volume')]
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
#[\PHPUnit\Framework\Attributes\CoversNothing]
|
||||
public function testVolume() : void
|
||||
{
|
||||
$text = new Text();
|
||||
|
|
|
|||
|
|
@ -21,10 +21,10 @@ use Modules\News\Models\NewsType;
|
|||
use phpOMS\Localization\ISO639x1Enum;
|
||||
|
||||
/**
|
||||
* @testdox Modules\News\tests\Models\NewsArticleTest: News article
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\News\Models\NewsArticle::class)]
|
||||
#[\PHPUnit\Framework\Attributes\TestDox('Modules\News\tests\Models\NewsArticleTest: News article')]
|
||||
final class NewsArticleTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
protected NewsArticle $news;
|
||||
|
|
@ -37,11 +37,8 @@ final class NewsArticleTest extends \PHPUnit\Framework\TestCase
|
|||
$this->news = new NewsArticle();
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox The model has the expected default values after initialization
|
||||
* @covers \Modules\News\Models\NewsArticle
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
#[\PHPUnit\Framework\Attributes\TestDox('The model has the expected default values after initialization')]
|
||||
public function testDefault() : void
|
||||
{
|
||||
self::assertEquals(0, $this->news->id);
|
||||
|
|
@ -58,77 +55,56 @@ final class NewsArticleTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals('', $this->news->plain);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox The creator can be correctly set and returned
|
||||
* @covers \Modules\News\Models\NewsArticle
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
#[\PHPUnit\Framework\Attributes\TestDox('The creator can be correctly set and returned')]
|
||||
public function testCreatorInputOutput() : void
|
||||
{
|
||||
$this->news->createdBy = new NullAccount(1);
|
||||
self::assertEquals(1, $this->news->createdBy->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox The title can be correctly set and returned
|
||||
* @covers \Modules\News\Models\NewsArticle
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
#[\PHPUnit\Framework\Attributes\TestDox('The title can be correctly set and returned')]
|
||||
public function testTitleInputOutput() : void
|
||||
{
|
||||
$this->news->title = 'Title';
|
||||
self::assertEquals('Title', $this->news->title);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox The content can be correctly set and returned
|
||||
* @covers \Modules\News\Models\NewsArticle
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
#[\PHPUnit\Framework\Attributes\TestDox('The content can be correctly set and returned')]
|
||||
public function testContentInputOutput() : void
|
||||
{
|
||||
$this->news->content = 'Content';
|
||||
self::assertEquals('Content', $this->news->content);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox The plain content can be correctly set and returned
|
||||
* @covers \Modules\News\Models\NewsArticle
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
#[\PHPUnit\Framework\Attributes\TestDox('The plain content can be correctly set and returned')]
|
||||
public function testPlainInputOutput() : void
|
||||
{
|
||||
$this->news->plain = 'Plain';
|
||||
self::assertEquals('Plain', $this->news->plain);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox The publish date can be correctly set and returned
|
||||
* @covers \Modules\News\Models\NewsArticle
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
#[\PHPUnit\Framework\Attributes\TestDox('The publish date can be correctly set and returned')]
|
||||
public function testPublishInputOutput() : void
|
||||
{
|
||||
$this->news->publish = $data = new \DateTime('2001-05-07');
|
||||
self::assertEquals($data, $this->news->publish);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox The featured flag can be correctly set and returned
|
||||
* @covers \Modules\News\Models\NewsArticle
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
#[\PHPUnit\Framework\Attributes\TestDox('The featured flag can be correctly set and returned')]
|
||||
public function testFeaturedInputOutput() : void
|
||||
{
|
||||
$this->news->isFeatured = true;
|
||||
self::assertTrue($this->news->isFeatured);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox The model can be correctly serialized
|
||||
* @covers \Modules\News\Models\NewsArticle
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
#[\PHPUnit\Framework\Attributes\TestDox('The model can be correctly serialized')]
|
||||
public function testSerialization() : void
|
||||
{
|
||||
$this->news->title = 'Title';
|
||||
|
|
|
|||
|
|
@ -17,10 +17,10 @@ namespace Modules\News\tests\Models;
|
|||
use Modules\News\Models\NewsSeen;
|
||||
|
||||
/**
|
||||
* @testdox Modules\News\tests\Models\NewsSeenTest: News article
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\News\Models\NewsSeen::class)]
|
||||
#[\PHPUnit\Framework\Attributes\TestDox('Modules\News\tests\Models\NewsSeenTest: News article')]
|
||||
final class NewsSeenTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
protected NewsSeen $seen;
|
||||
|
|
@ -33,10 +33,7 @@ final class NewsSeenTest extends \PHPUnit\Framework\TestCase
|
|||
$this->seen = new NewsSeen();
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \Modules\News\Models\NewsSeen
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
public function testDefault() : void
|
||||
{
|
||||
self::assertEquals(0, $this->seen->id);
|
||||
|
|
|
|||
|
|
@ -19,31 +19,23 @@ use Modules\News\Models\NullNewsArticle;
|
|||
/**
|
||||
* @internal
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\News\Models\NullNewsArticle::class)]
|
||||
final class NullNewsArticleTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @covers \Modules\News\Models\NullNewsArticle
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
public function testNull() : void
|
||||
{
|
||||
self::assertInstanceOf('\Modules\News\Models\NewsArticle', new NullNewsArticle());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \Modules\News\Models\NullNewsArticle
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
public function testId() : void
|
||||
{
|
||||
$null = new NullNewsArticle(2);
|
||||
self::assertEquals(2, $null->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \Modules\News\Models\NullNewsArticle
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
public function testJsonSerialize() : void
|
||||
{
|
||||
$null = new NullNewsArticle(2);
|
||||
|
|
|
|||
|
|
@ -19,31 +19,23 @@ use Modules\News\Models\NullNewsSeen;
|
|||
/**
|
||||
* @internal
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\News\Models\NullNewsSeen::class)]
|
||||
final class NullNewsSeenTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @covers \Modules\News\Models\NullNewsSeen
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
public function testNull() : void
|
||||
{
|
||||
self::assertInstanceOf('\Modules\News\Models\NewsSeen', new NullNewsSeen());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \Modules\News\Models\NullNewsSeen
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
public function testId() : void
|
||||
{
|
||||
$null = new NullNewsSeen(2);
|
||||
self::assertEquals(2, $null->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \Modules\News\Models\NullNewsSeen
|
||||
* @group module
|
||||
*/
|
||||
#[\PHPUnit\Framework\Attributes\Group('module')]
|
||||
public function testJsonSerialize() : void
|
||||
{
|
||||
$null = new NullNewsSeen(2);
|
||||
|
|
|
|||
|
|
@ -1,31 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="Bootstrap.php" colors="true" columns="120" stopOnError="true" stopOnFailure="false" stopOnIncomplete="false" stopOnSkipped="false" beStrictAboutTestsThatDoNotTestAnything="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
|
||||
<coverage includeUncoveredFiles="true" processUncoveredFiles="false">
|
||||
<include>
|
||||
<directory suffix=".php">../</directory>
|
||||
</include>
|
||||
<exclude>
|
||||
<directory>../vendor*</directory>
|
||||
<directory>../MainRepository*</directory>
|
||||
<directory>../Karaka*</directory>
|
||||
<directory>../Admin/Install/Application*</directory>
|
||||
<directory>../phpOMS*</directory>
|
||||
<directory>../tests*</directory>
|
||||
<directory>../*/tests*</directory>
|
||||
<directory>../**/tests*</directory>
|
||||
<directory>*/tests*</directory>
|
||||
<directory suffix="tpl.php">../*</directory>
|
||||
<directory suffix="lang.php">../*</directory>
|
||||
<directory suffix="Test.php">../*</directory>
|
||||
<directory suffix="Routes.php">../*</directory>
|
||||
<directory suffix="Hooks.php">../*</directory>
|
||||
<directory>../**/test*</directory>
|
||||
<directory>../**/Theme*</directory>
|
||||
<directory>../**/Admin/Routes*</directory>
|
||||
<directory>../**/Admin/Hooks*</directory>
|
||||
<directory>../**/Admin/Install*</directory>
|
||||
<directory>../Media/Files*</directory>
|
||||
</exclude>
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="Bootstrap.php" colors="true" columns="120" stopOnError="true" stopOnFailure="false" stopOnIncomplete="false" stopOnSkipped="false" beStrictAboutTestsThatDoNotTestAnything="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.0/phpunit.xsd" cacheDirectory=".phpunit.cache">
|
||||
<coverage includeUncoveredFiles="true">
|
||||
<report>
|
||||
<clover outputFile="coverage.xml"/>
|
||||
<html outputDirectory="../tests" lowUpperBound="75" highLowerBound="95"/>
|
||||
|
|
@ -56,4 +31,31 @@
|
|||
<const name="WEB_SERVER_DOCROOT" value="./Karaka"/>
|
||||
<const name="RESET" value="1"/>
|
||||
</php>
|
||||
<source>
|
||||
<include>
|
||||
<directory suffix=".php">../</directory>
|
||||
</include>
|
||||
<exclude>
|
||||
<directory>../vendor*</directory>
|
||||
<directory>../MainRepository*</directory>
|
||||
<directory>../Karaka*</directory>
|
||||
<directory>../Admin/Install/Application*</directory>
|
||||
<directory>../phpOMS*</directory>
|
||||
<directory>../tests*</directory>
|
||||
<directory>../*/tests*</directory>
|
||||
<directory>../**/tests*</directory>
|
||||
<directory>*/tests*</directory>
|
||||
<directory suffix="tpl.php">../*</directory>
|
||||
<directory suffix="lang.php">../*</directory>
|
||||
<directory suffix="Test.php">../*</directory>
|
||||
<directory suffix="Routes.php">../*</directory>
|
||||
<directory suffix="Hooks.php">../*</directory>
|
||||
<directory>../**/test*</directory>
|
||||
<directory>../**/Theme*</directory>
|
||||
<directory>../**/Admin/Routes*</directory>
|
||||
<directory>../**/Admin/Hooks*</directory>
|
||||
<directory>../**/Admin/Install*</directory>
|
||||
<directory>../Media/Files*</directory>
|
||||
</exclude>
|
||||
</source>
|
||||
</phpunit>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user