mirror of
https://github.com/Karaka-Management/oms-QA.git
synced 2026-01-11 15:48:42 +00:00
add unit tests
This commit is contained in:
parent
7ffe998262
commit
1f064cd1cb
|
|
@ -77,4 +77,16 @@ class QAAnswerVote
|
|||
$this->createdBy = new NullAccount();
|
||||
$this->createdAt = new \DateTimeImmutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get model id.
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getId() : int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,4 +77,16 @@ class QAQuestionVote
|
|||
$this->createdBy = new NullAccount();
|
||||
$this->createdAt = new \DateTimeImmutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get model id.
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getId() : int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,25 +51,4 @@ final class QAQuestionMapperTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals($question->getLanguage(), $questionR->getLanguage());
|
||||
self::assertEquals($question->createdBy->account->getId(), $questionR->createdBy->account->getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* @group volume
|
||||
* @group module
|
||||
* @coversNothing
|
||||
*/
|
||||
public function testVolume() : void
|
||||
{
|
||||
for ($i = 1; $i < 30; ++$i) {
|
||||
$text = new Text();
|
||||
$question = new QAQuestion();
|
||||
|
||||
$question->name = $text->generateText(\mt_rand(1, 3));
|
||||
$question->question = $text->generateText(\mt_rand(100, 500));
|
||||
$question->setStatus(QAQuestionStatus::ACTIVE);
|
||||
$question->createdBy = new Profile(new NullAccount(1));
|
||||
$question->setLanguage('en');
|
||||
|
||||
$id = QAQuestionMapper::create($question);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,24 +52,4 @@ final class QAAnswerMapperTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals($answer->isAccepted, $answerR->isAccepted);
|
||||
self::assertEquals($answer->createdBy->account->getId(), $answerR->createdBy->account->getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* @group volume
|
||||
* @group module
|
||||
* @coversNothing
|
||||
*/
|
||||
public function testVolume() : void
|
||||
{
|
||||
for ($i = 1; $i < 30; ++$i) {
|
||||
$text = new Text();
|
||||
$answer = new QAAnswer();
|
||||
|
||||
$answer->setAnswer($text->generateText(\mt_rand(100, 500)));
|
||||
$answer->createdBy = new Profile(new NullAccount(1));
|
||||
$answer->setStatus(QAAnswerStatus::ACTIVE);
|
||||
$answer->setQuestion(new NullQAQuestion(1));
|
||||
|
||||
$id = QAAnswerMapper::create($answer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
42
tests/Models/NullQAAnswerTest.php
Normal file
42
tests/Models/NullQAAnswerTest.php
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 8.0
|
||||
*
|
||||
* @package tests
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://orange-management.org
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\QA\tests\Models;
|
||||
|
||||
use Modules\QA\Models\NullQAAnswer;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class NullQAAnswerTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @covers Modules\QA\Models\NullQAAnswer
|
||||
* @group module
|
||||
*/
|
||||
public function testNull() : void
|
||||
{
|
||||
self::assertInstanceOf('\Modules\QA\Models\QAAnswer', new NullQAAnswer());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\QA\Models\NullQAAnswer
|
||||
* @group module
|
||||
*/
|
||||
public function testId() : void
|
||||
{
|
||||
$null = new NullQAAnswer(2);
|
||||
self::assertEquals(2, $null->getId());
|
||||
}
|
||||
}
|
||||
42
tests/Models/NullQAAnswerVoteTest.php
Normal file
42
tests/Models/NullQAAnswerVoteTest.php
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 8.0
|
||||
*
|
||||
* @package tests
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://orange-management.org
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\QA\tests\Models;
|
||||
|
||||
use Modules\QA\Models\NullQAAnswerVote;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class NullQAAnswerVoteTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @covers Modules\QA\Models\NullQAAnswerVote
|
||||
* @group module
|
||||
*/
|
||||
public function testNull() : void
|
||||
{
|
||||
self::assertInstanceOf('\Modules\QA\Models\QAAnswerVote', new NullQAAnswerVote());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\QA\Models\NullQAAnswerVote
|
||||
* @group module
|
||||
*/
|
||||
public function testId() : void
|
||||
{
|
||||
$null = new NullQAAnswerVote(2);
|
||||
self::assertEquals(2, $null->getId());
|
||||
}
|
||||
}
|
||||
42
tests/Models/NullQAAppTest.php
Normal file
42
tests/Models/NullQAAppTest.php
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 8.0
|
||||
*
|
||||
* @package tests
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://orange-management.org
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\QA\tests\Models;
|
||||
|
||||
use Modules\QA\Models\NullQAApp;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class NullQAAppTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @covers Modules\QA\Models\NullQAApp
|
||||
* @group module
|
||||
*/
|
||||
public function testNull() : void
|
||||
{
|
||||
self::assertInstanceOf('\Modules\QA\Models\QAApp', new NullQAApp());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\QA\Models\NullQAApp
|
||||
* @group module
|
||||
*/
|
||||
public function testId() : void
|
||||
{
|
||||
$null = new NullQAApp(2);
|
||||
self::assertEquals(2, $null->getId());
|
||||
}
|
||||
}
|
||||
42
tests/Models/NullQAQuestionTest.php
Normal file
42
tests/Models/NullQAQuestionTest.php
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 8.0
|
||||
*
|
||||
* @package tests
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://orange-management.org
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\QA\tests\Models;
|
||||
|
||||
use Modules\QA\Models\NullQAQuestion;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class NullQAQuestionTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @covers Modules\QA\Models\NullQAQuestion
|
||||
* @group module
|
||||
*/
|
||||
public function testNull() : void
|
||||
{
|
||||
self::assertInstanceOf('\Modules\QA\Models\QAQuestion', new NullQAQuestion());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\QA\Models\NullQAQuestion
|
||||
* @group module
|
||||
*/
|
||||
public function testId() : void
|
||||
{
|
||||
$null = new NullQAQuestion(2);
|
||||
self::assertEquals(2, $null->getId());
|
||||
}
|
||||
}
|
||||
42
tests/Models/NullQAQuestionVoteTest.php
Normal file
42
tests/Models/NullQAQuestionVoteTest.php
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 8.0
|
||||
*
|
||||
* @package tests
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://orange-management.org
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\QA\tests\Models;
|
||||
|
||||
use Modules\QA\Models\NullQAQuestionVote;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class NullQAQuestionVoteTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @covers Modules\QA\Models\NullQAQuestionVote
|
||||
* @group module
|
||||
*/
|
||||
public function testNull() : void
|
||||
{
|
||||
self::assertInstanceOf('\Modules\QA\Models\QAQuestionVote', new NullQAQuestionVote());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\QA\Models\NullQAQuestionVote
|
||||
* @group module
|
||||
*/
|
||||
public function testId() : void
|
||||
{
|
||||
$null = new NullQAQuestionVote(2);
|
||||
self::assertEquals(2, $null->getId());
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="Bootstrap.php" colors="true" stopOnError="true" stopOnFailure="false" stopOnIncomplete="false" stopOnSkipped="false" beStrictAboutTestsThatDoNotTestAnything="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
|
||||
<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">
|
||||
<exclude>
|
||||
<directory>*vendor*</directory>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user