make id public, organigram impl. media password/encryption, settings bug fix, Money->FloatInt change, ...

This commit is contained in:
Dennis Eichhorn 2023-05-06 11:42:06 +00:00
parent 3d96b3913d
commit f3687812a6
26 changed files with 82 additions and 80 deletions

View File

@ -151,7 +151,7 @@ final class Application
$account = $this->loadAccount($request);
if (!($account instanceof NullAccount)) {
if ($account->id > 0) {
$response->header->l11n = $account->l11n;
} elseif ($this->app->sessionManager->get('language') !== null
&& $response->header->l11n->getLanguage() !== $this->app->sessionManager->get('language')
@ -161,6 +161,8 @@ final class Application
$this->app->sessionManager->get('language'),
$this->app->sessionManager->get('country') ?? '*'
);
} else {
$this->app->setResponseLanguage($request, $response, $this->config);
}
if (!\in_array($response->getLanguage(), $this->config['language'])) {

View File

@ -59,7 +59,7 @@ echo $this->getData('nav')->render(); ?>
foreach ($apps as $key => $app) : ++$count;
$url = UriFactory::build('{/base}/admin/module/settings?id=QA&app=' . $app->id); ?>
<tr tabindex="0" data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><?= $app->getId(); ?></a>
<td><a href="<?= $url; ?>"><?= $app->id; ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($app->name); ?></a>
<?php endforeach; ?>
<?php if ($count === 0) : ?>

View File

@ -344,11 +344,11 @@ final class ApiController extends Controller
/** @var \Modules\QA\Models\QAAnswer $oldAccepted */
$oldAccepted = QAAnswerMapper::get()
->where('question', $old->question->getId())
->where('question', $old->question->id)
->where('isAccepted', true)
->execute();
if ($old->getId() !== $oldAccepted->getId()) {
if ($old->id !== $oldAccepted->id) {
$oldUnaccepted = clone $oldAccepted;
$oldUnaccepted->isAccepted = !$oldUnaccepted->isAccepted;
@ -474,7 +474,7 @@ final class ApiController extends Controller
->where('createdBy', $request->header->account)
->execute();
if ($questionVote === false || $questionVote instanceof NullQAQuestionVote || $questionVote === null) {
if ($questionVote->id === 0) {
/** @var \Modules\QA\Models\QAQuestion $question */
$question = QAQuestionMapper::get()->where('id', (int) $request->getData('id'))->execute();
@ -482,7 +482,7 @@ final class ApiController extends Controller
$new->score = (int) $request->getData('type');
$new->question = (int) $request->getData('id');
$new->createdBy = new NullAccount($request->header->account);
$new->createdFor = $question->createdBy->getId();
$new->createdFor = $question->createdBy->id;
$this->createModel($request->header->account, $new, QAQuestionVoteMapper::class, 'qa_question_vote', $request->getOrigin());
$this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Vote', 'Sucessfully voted.', $new);
@ -549,7 +549,7 @@ final class ApiController extends Controller
->where('createdBy', $request->header->account)
->execute();
if ($answerVote === false || $answerVote instanceof NullQAAnswerVote || $answerVote === null) {
if ($answerVote->id === 0) {
/** @var \Modules\QA\Models\QAAnswer $answer */
$answer = QAAnswerMapper::get()->where('id', (int) $request->getData('id'))->execute();
@ -557,7 +557,7 @@ final class ApiController extends Controller
$new->score = (int) $request->getData('type');
$new->answer = (int) $request->getData('id');
$new->createdBy = new NullAccount($request->header->account);
$new->createdFor = $answer->createdBy->getId();
$new->createdFor = $answer->createdBy->id;
$this->createModel($request->header->account, $new, QAAnswerVoteMapper::class, 'qa_answer_vote', $request->getOrigin());
$this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Vote', 'Sucessfully voted.', $new);

View File

@ -34,7 +34,7 @@ class QAAnswer implements \JsonSerializable
* @var int
* @since 1.0.0
*/
protected int $id = 0;
public int $id = 0;
/**
* Status.
@ -42,7 +42,7 @@ class QAAnswer implements \JsonSerializable
* @var int
* @since 1.0.0
*/
private int $status = QAAnswerStatus::ACTIVE;
public int $status = QAAnswerStatus::ACTIVE;
/**
* Answer.
@ -187,7 +187,7 @@ class QAAnswer implements \JsonSerializable
public function getAccountVoteScore(int $account) : int
{
foreach ($this->votes as $vote) {
if ($vote->createdBy->getId() === $account) {
if ($vote->createdBy->id === $account) {
return $vote->score;
}
}

View File

@ -33,7 +33,7 @@ class QAAnswerVote
* @var int
* @since 1.0.0
*/
protected int $id = 0;
public int $id = 0;
/**
* Account.

View File

@ -30,7 +30,7 @@ class QAApp implements \JsonSerializable
* @var int
* @since 1.0.0
*/
protected int $id = 0;
public int $id = 0;
/**
* Application name.

View File

@ -37,7 +37,7 @@ class QAQuestion implements \JsonSerializable
* @var int
* @since 1.0.0
*/
protected int $id = 0;
public int $id = 0;
/**
* Title.
@ -53,7 +53,7 @@ class QAQuestion implements \JsonSerializable
* @var int
* @since 1.0.0
*/
private int $status = QAQuestionStatus::ACTIVE;
public int $status = QAQuestionStatus::ACTIVE;
/**
* Question.
@ -77,7 +77,7 @@ class QAQuestion implements \JsonSerializable
* @var string
* @since 1.0.0
*/
private string $language = ISO639x1Enum::_EN;
public string $language = ISO639x1Enum::_EN;
/**
* Created by.
@ -166,10 +166,10 @@ class QAQuestion implements \JsonSerializable
public function getAccounts() : array
{
$accounts = [];
$accounts[] = $this->createdBy->account->getId();
$accounts[] = $this->createdBy->account->id;
foreach ($this->answers as $answer) {
$accounts[] = $answer->createdBy->account->getId();
$accounts[] = $answer->createdBy->account->id;
}
return \array_unique($accounts);
@ -378,7 +378,7 @@ class QAQuestion implements \JsonSerializable
public function getAccountVoteScore(int $account) : int
{
foreach ($this->votes as $vote) {
if ($vote->createdBy->getId() === $account) {
if ($vote->createdBy->id === $account) {
return $vote->score;
}
}

View File

@ -33,7 +33,7 @@ class QAQuestionVote
* @var int
* @since 1.0.0
*/
protected int $id = 0;
public int $id = 0;
/**
* Account.

View File

@ -28,7 +28,7 @@ echo $this->getData('nav')->render(); ?>
<select name="app">
<option value="0"><?= $this->getHtml('All'); ?>
<?php foreach ($apps as $app) : ?>
<option value="<?= $app->getId(); ?>"><?= $app->name; ?>
<option value="<?= $app->id; ?>"><?= $app->name; ?>
<?php endforeach; ?>
</select>
</div>
@ -51,7 +51,7 @@ echo $this->getData('nav')->render(); ?>
</div>
</div>
<div class="title">
<a href="<?= UriFactory::build('{/base}/qa/question?{?}&id=' . $question->getId()); ?>"><?= $this->printHtml($question->name); ?></a>
<a href="<?= UriFactory::build('{/base}/qa/question?{?}&id=' . $question->id); ?>"><?= $this->printHtml($question->name); ?></a>
</div>
</div>
</div>
@ -62,9 +62,9 @@ echo $this->getData('nav')->render(); ?>
<?php endforeach; ?>
</div>
<a class="account-info" href="<?= UriFactory::build('{/base}/profile/single?{?}&id=' . $question->createdBy->getId()); ?>">
<a class="account-info" href="<?= UriFactory::build('{/base}/profile/single?{?}&id=' . $question->createdBy->id); ?>">
<span class="name content"><?= $this->printHtml($question->createdBy->account->name2); ?> <?= $this->printHtml($question->createdBy->account->name1); ?></span>
<?php if ($question->createdBy->image !== null && !($question->createdBy->image instanceof NullMedia)) : ?>
<?php if ($question->createdBy->image->id > 0) : ?>
<img width="40px" alt="<?= $this->getHtml('AccountImage', '0', '0'); ?>" loading="lazy" src="<?= UriFactory::build('{/base}/' . $question->createdBy->image->getPath()); ?>">
<?php endif; ?>
</a>

View File

@ -37,7 +37,7 @@ echo $this->getData('nav')->render();
{
"key": 1, "listener": "click", "action": [
{"key": 1, "type": "event.prevent"},
{"key": 2, "type": "message.request", "uri": "<?= UriFactory::build('{/api}qa/question/vote?id=' . $question->getId());?>&type=1", "method": "PUT", "request_type": "json"}
{"key": 2, "type": "message.request", "uri": "<?= UriFactory::build('{/api}qa/question/vote?id=' . $question->id);?>&type=1", "method": "PUT", "request_type": "json"}
]
}
]' href="#">
@ -49,7 +49,7 @@ echo $this->getData('nav')->render();
{
"key": 1, "listener": "click", "action": [
{"key": 1, "type": "event.prevent"},
{"key": 2, "type": "message.request", "uri": "<?= UriFactory::build('{/api}qa/question/vote?id=' . $question->getId());?>&type=-1", "method": "PUT", "request_type": "json"}
{"key": 2, "type": "message.request", "uri": "<?= UriFactory::build('{/api}qa/question/vote?id=' . $question->id);?>&type=-1", "method": "PUT", "request_type": "json"}
]
}
]' href="#">
@ -75,16 +75,16 @@ echo $this->getData('nav')->render();
</div>
<?php $files = $question->getMedia(); foreach ($files as $file) : ?>
<span><a class="content" href="<?= UriFactory::build('{/app}/media/single?id=' . $file->getId());?>"><?= $file->name; ?></a></span>
<span><a class="content" href="<?= UriFactory::build('{/app}/media/single?id=' . $file->id);?>"><?= $file->name; ?></a></span>
<?php endforeach; ?>
<a class="account-info" href="<?= UriFactory::build('{/app}/profile/single?{?}&id=' . $question->createdBy->getId()); ?>">
<a class="account-info" href="<?= UriFactory::build('{/app}/profile/single?{?}&id=' . $question->createdBy->id); ?>">
<span class="name">
<div class="content"><?= $this->printHtml($question->createdBy->account->name2); ?> <?= $this->printHtml($question->createdBy->account->name1); ?></div>
<div class="name-score">Score: <?= $scores[$question->createdBy->account->getId()] ?? 0; ?></div>
<div class="name-score">Score: <?= $scores[$question->createdBy->account->id] ?? 0; ?></div>
</span>
<?php if ($question->createdBy->image !== null && !($question->createdBy->image instanceof NullMedia)) : ?>
<?php if ($question->createdBy->image->id > 0) : ?>
<img width="40px" alt="<?= $this->getHtml('AccountImage', '0', '0'); ?>" loading="lazy" src="<?= UriFactory::build('{/app}/' . $question->createdBy->image->getPath()); ?>">
<?php endif; ?>
</a>
@ -101,11 +101,11 @@ echo $this->getData('nav')->render();
<div class="score">
<div class="counter-area">
<div class="counter-container">
<a id="qa-answer-upvote-<?= $answer->getId(); ?>" data-action='[
<a id="qa-answer-upvote-<?= $answer->id; ?>" data-action='[
{
"key": 1, "listener": "click", "action": [
{"key": 1, "type": "event.prevent"},
{"key": 2, "type": "message.request", "uri": "<?= UriFactory::build('{/api}qa/answer/vote?id=' . $answer->getId());?>&type=1", "method": "PUT", "request_type": "json"}
{"key": 2, "type": "message.request", "uri": "<?= UriFactory::build('{/api}qa/answer/vote?id=' . $answer->id);?>&type=1", "method": "PUT", "request_type": "json"}
]
}
]' href="#">
@ -113,11 +113,11 @@ echo $this->getData('nav')->render();
</a>
<span class="counter"><?= $answer->getVoteScore(); ?></span>
<span class="text">Score</span>
<a id="qa-answer-downvote-<?= $answer->getId(); ?>" data-action='[
<a id="qa-answer-downvote-<?= $answer->id; ?>" data-action='[
{
"key": 1, "listener": "click", "action": [
{"key": 1, "type": "event.prevent"},
{"key": 2, "type": "message.request", "uri": "<?= UriFactory::build('{/api}qa/answer/vote?id=' . $answer->getId());?>&type=-1", "method": "PUT", "request_type": "json"}
{"key": 2, "type": "message.request", "uri": "<?= UriFactory::build('{/api}qa/answer/vote?id=' . $answer->id);?>&type=-1", "method": "PUT", "request_type": "json"}
]
}
]' href="#">
@ -125,11 +125,11 @@ echo $this->getData('nav')->render();
</a>
</div>
<div class="counter-container">
<a id="qa-answer-accept-<?= $answer->getId(); ?>" data-action='[
<a id="qa-answer-accept-<?= $answer->id; ?>" data-action='[
{
"key": 1, "listener": "click", "action": [
{"key": 1, "type": "event.prevent"},
{"key": 2, "type": "message.request", "uri": "<?= UriFactory::build('{/api}qa/answer/accept?id=' . $answer->getId());?>&type=1", "method": "PUT", "request_type": "json"}
{"key": 2, "type": "message.request", "uri": "<?= UriFactory::build('{/api}qa/answer/accept?id=' . $answer->id);?>&type=1", "method": "PUT", "request_type": "json"}
]
}
]' href="#">
@ -147,15 +147,15 @@ echo $this->getData('nav')->render();
</div>
<div class="portlet-foot qa-portlet-foot">
<?php $files = $answer->getMedia(); foreach ($files as $file) : ?>
<span><a class="content" href="<?= UriFactory::build('{/app}/media/single?id=' . $file->getId());?>"><?= $file->name; ?></a></span>
<span><a class="content" href="<?= UriFactory::build('{/app}/media/single?id=' . $file->id);?>"><?= $file->name; ?></a></span>
<?php endforeach; ?>
<a class="account-info" href="<?= UriFactory::build('{/app}/profile/single?{?}&id=' . $answer->createdBy->getId()); ?>">
<a class="account-info" href="<?= UriFactory::build('{/app}/profile/single?{?}&id=' . $answer->createdBy->id); ?>">
<span class="name">
<div class="content"><?= $this->printHtml($answer->createdBy->account->name2); ?> <?= $this->printHtml($answer->createdBy->account->name1); ?></div>
<div class="name-score">Score: <?= $scores[$answer->createdBy->account->getId()] ?? 0; ?></div>
<div class="name-score">Score: <?= $scores[$answer->createdBy->account->id] ?? 0; ?></div>
</span>
<?php if ($answer->createdBy->image !== null && !($answer->createdBy->image instanceof NullMedia)) : ?>
<?php if ($answer->createdBy->image->id > 0) : ?>
<img width="40px" alt="<?= $this->getHtml('AccountImage', '0', '0'); ?>" loading="lazy" src="<?= UriFactory::build('{/app}/' . $answer->createdBy->image->getPath()); ?>">
<?php endif; ?>
</a>

View File

@ -32,9 +32,9 @@ echo $this->getData('nav')->render();
<tr><td colspan="2">
<tbody>
<?php $c = 0; foreach ($tags as $key => $value) : ++$c;
$url = \phpOMS\Uri\UriFactory::build('{/base}/admin/account/settings?{?}&id=' . $value->getId()); ?>
$url = \phpOMS\Uri\UriFactory::build('{/base}/admin/account/settings?{?}&id=' . $value->id); ?>
<tr tabindex="0" data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><?= $value->getId(); ?></a>
<td><a href="<?= $url; ?>"><?= $value->id; ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->name); ?></a>
<?php endforeach; ?>
<?php if ($c === 0) : ?>

View File

@ -109,7 +109,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
$request->setData('name', 'TestQAApp');
$this->module->apiQAAppCreate($request, $response);
self::assertGreaterThan(0, $response->get('')['response']->getId());
self::assertGreaterThan(0, $response->get('')['response']->id);
}
/**
@ -161,7 +161,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
$request->setData('media', \json_encode([1]));
$this->module->apiQAQuestionCreate($request, $response);
self::assertGreaterThan(0, $response->get('')['response']->getId());
self::assertGreaterThan(0, $response->get('')['response']->id);
}
/**
@ -211,7 +211,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
$request->setData('media', \json_encode([1]));
$this->module->apiQAAnswerCreate($request, $response);
self::assertGreaterThan(0, $response->get('')['response']->getId());
self::assertGreaterThan(0, $response->get('')['response']->id);
}
/**
@ -228,7 +228,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
$request->setData('accepted', '1');
$this->module->apiChangeAnsweredStatus($request, $response);
self::assertGreaterThan(0, $response->get('')['response']->getId());
self::assertGreaterThan(0, $response->get('')['response']->id);
}
/**
@ -261,7 +261,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
$request->setData('type', '-1');
$this->module->apiChangeQAQuestionVote($request, $response);
self::assertGreaterThan(0, $response->get('')['response']->getId());
self::assertGreaterThan(0, $response->get('')['response']->id);
$response = new HttpResponse();
$request = new HttpRequest(new HttpUri(''));
@ -271,7 +271,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
$request->setData('type', '1');
$this->module->apiChangeQAQuestionVote($request, $response);
self::assertGreaterThan(0, $response->get('')['response']->getId());
self::assertGreaterThan(0, $response->get('')['response']->id);
}
/**
@ -304,7 +304,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
$request->setData('type', '-1');
$this->module->apiChangeQAAnswerVote($request, $response);
self::assertGreaterThan(0, $response->get('')['response']->getId());
self::assertGreaterThan(0, $response->get('')['response']->id);
$response = new HttpResponse();
$request = new HttpRequest(new HttpUri(''));
@ -314,7 +314,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
$request->setData('type', '1');
$this->module->apiChangeQAAnswerVote($request, $response);
self::assertGreaterThan(0, $response->get('')['response']->getId());
self::assertGreaterThan(0, $response->get('')['response']->id);
}
/**

View File

@ -37,6 +37,6 @@ final class NullQAAnswerTest extends \PHPUnit\Framework\TestCase
public function testId() : void
{
$null = new NullQAAnswer(2);
self::assertEquals(2, $null->getId());
self::assertEquals(2, $null->id);
}
}

View File

@ -37,6 +37,6 @@ final class NullQAAnswerVoteTest extends \PHPUnit\Framework\TestCase
public function testId() : void
{
$null = new NullQAAnswerVote(2);
self::assertEquals(2, $null->getId());
self::assertEquals(2, $null->id);
}
}

View File

@ -37,6 +37,6 @@ final class NullQAAppTest extends \PHPUnit\Framework\TestCase
public function testId() : void
{
$null = new NullQAApp(2);
self::assertEquals(2, $null->getId());
self::assertEquals(2, $null->id);
}
}

View File

@ -37,6 +37,6 @@ final class NullQAQuestionTest extends \PHPUnit\Framework\TestCase
public function testId() : void
{
$null = new NullQAQuestion(2);
self::assertEquals(2, $null->getId());
self::assertEquals(2, $null->id);
}
}

View File

@ -37,6 +37,6 @@ final class NullQAQuestionVoteTest extends \PHPUnit\Framework\TestCase
public function testId() : void
{
$null = new NullQAQuestionVote(2);
self::assertEquals(2, $null->getId());
self::assertEquals(2, $null->id);
}
}

View File

@ -42,14 +42,14 @@ final class QAAnswerMapperTest extends \PHPUnit\Framework\TestCase
$answer->isAccepted = true;
$id = QAAnswerMapper::create()->execute($answer);
self::assertGreaterThan(0, $answer->getId());
self::assertEquals($id, $answer->getId());
self::assertGreaterThan(0, $answer->id);
self::assertEquals($id, $answer->id);
$answerR = QAAnswerMapper::get()->with('createdBy')->with('account')->where('id', $answer->getId())->execute();
$answerR = QAAnswerMapper::get()->with('createdBy')->with('account')->where('id', $answer->id)->execute();
self::assertEquals($answer->answer, $answerR->answer);
self::assertEquals($answer->question->getId(), $answerR->question->getId());
self::assertEquals($answer->question->id, $answerR->question->id);
self::assertEquals($answer->getStatus(), $answerR->getStatus());
self::assertEquals($answer->isAccepted, $answerR->isAccepted);
self::assertEquals($answer->createdBy->account->getId(), $answerR->createdBy->account->getId());
self::assertEquals($answer->createdBy->account->id, $answerR->createdBy->account->id);
}
}

View File

@ -41,12 +41,12 @@ final class QAAnswerTest extends \PHPUnit\Framework\TestCase
*/
public function testDefault() : void
{
self::assertEquals(0, $this->answer->getId());
self::assertEquals(0, $this->answer->id);
self::assertEquals('', $this->answer->answer);
self::assertEquals(0, $this->answer->question->getId());
self::assertEquals(0, $this->answer->question->id);
self::assertFalse($this->answer->isAccepted);
self::assertEquals(QAAnswerStatus::ACTIVE, $this->answer->getStatus());
self::assertEquals(0, $this->answer->createdBy->getId());
self::assertEquals(0, $this->answer->createdBy->id);
self::assertEquals(0, $this->answer->getVoteScore());
self::assertEquals(0, $this->answer->getAccountVoteScore(0));
self::assertEquals([], $this->answer->getMedia());

View File

@ -37,10 +37,10 @@ final class QAAnswerVoteMapperTest extends \PHPUnit\Framework\TestCase
$vote->createdFor = 2;
$id = QAAnswerVoteMapper::create()->execute($vote);
self::assertGreaterThan(0, $vote->getId());
self::assertEquals($id, $vote->getId());
self::assertGreaterThan(0, $vote->id);
self::assertEquals($id, $vote->id);
$voteR = QAAnswerVoteMapper::get()->where('id', $vote->getId())->execute();
$voteR = QAAnswerVoteMapper::get()->where('id', $vote->id)->execute();
self::assertEquals($vote->answer, $voteR->answer);
self::assertEquals($vote->score, $voteR->score);
@ -50,7 +50,7 @@ final class QAAnswerVoteMapperTest extends \PHPUnit\Framework\TestCase
->where('createdBy', 1)
->limit(1)
->execute()
->getId()
->id
);
}
}

View File

@ -37,7 +37,7 @@ final class QAAnswerVoteTest extends \PHPUnit\Framework\TestCase
*/
public function testDefault() : void
{
self::assertEquals(0, $this->vote->getId());
self::assertEquals(0, $this->vote->id);
self::assertEquals(0, $this->vote->answer);
self::assertEquals(0, $this->vote->score);
}

View File

@ -37,7 +37,7 @@ final class QAAppTest extends \PHPUnit\Framework\TestCase
*/
public function testDefault() : void
{
self::assertEquals(0, $this->app->getId());
self::assertEquals(0, $this->app->id);
self::assertEquals('', $this->app->name);
}

View File

@ -40,14 +40,14 @@ final class QAQuestionMapperTest extends \PHPUnit\Framework\TestCase
$question->setLanguage('en');
$id = QAQuestionMapper::create()->execute($question);
self::assertGreaterThan(0, $question->getId());
self::assertEquals($id, $question->getId());
self::assertGreaterThan(0, $question->id);
self::assertEquals($id, $question->id);
$questionR = QAQuestionMapper::get()->with('createdBy')->with('createdBy/account')->where('id', $question->getId())->execute();
$questionR = QAQuestionMapper::get()->with('createdBy')->with('createdBy/account')->where('id', $question->id)->execute();
self::assertEquals($question->name, $questionR->name);
self::assertEquals($question->question, $questionR->question);
self::assertEquals($question->getStatus(), $questionR->getStatus());
self::assertEquals($question->getLanguage(), $questionR->getLanguage());
self::assertEquals($question->createdBy->account->getId(), $questionR->createdBy->account->getId());
self::assertEquals($question->createdBy->account->id, $questionR->createdBy->account->id);
}
}

View File

@ -45,13 +45,13 @@ final class QAQuestionTest extends \PHPUnit\Framework\TestCase
*/
public function testDefault() : void
{
self::assertEquals(0, $this->question->getId());
self::assertEquals(0, $this->question->id);
self::assertEquals('', $this->question->name);
self::assertEquals('', $this->question->question);
self::assertEquals('', $this->question->questionRaw);
self::assertEquals(QAQuestionStatus::ACTIVE, $this->question->getStatus());
self::assertEquals(ISO639x1Enum::_EN, $this->question->getLanguage());
self::assertEquals(0, $this->question->createdBy->getId());
self::assertEquals(0, $this->question->createdBy->id);
self::assertInstanceOf('\DateTimeImmutable', $this->question->createdAt);
self::assertFalse($this->question->hasAccepted());
self::assertEquals([0 => 0], $this->question->getAccounts()); // includes createdBy

View File

@ -37,10 +37,10 @@ final class QAQuestionVoteMapperTest extends \PHPUnit\Framework\TestCase
$vote->createdFor = 2;
$id = QAQuestionVoteMapper::create()->execute($vote);
self::assertGreaterThan(0, $vote->getId());
self::assertEquals($id, $vote->getId());
self::assertGreaterThan(0, $vote->id);
self::assertEquals($id, $vote->id);
$voteR = QAQuestionVoteMapper::get()->where('id', $vote->getId())->execute();
$voteR = QAQuestionVoteMapper::get()->where('id', $vote->id)->execute();
self::assertEquals($vote->question, $voteR->question);
self::assertEquals($vote->score, $voteR->score);
@ -49,7 +49,7 @@ final class QAQuestionVoteMapperTest extends \PHPUnit\Framework\TestCase
->where('question', 1)
->where('createdBy', 1)
->limit(1)
->execute()->getId()
->execute()->id
);
}
}

View File

@ -37,7 +37,7 @@ final class QAQuestionVoteTest extends \PHPUnit\Framework\TestCase
*/
public function testDefault() : void
{
self::assertEquals(0, $this->vote->getId());
self::assertEquals(0, $this->vote->id);
self::assertEquals(0, $this->vote->question);
self::assertEquals(0, $this->vote->score);
}