autofixes

This commit is contained in:
Dennis Eichhorn 2020-08-30 20:13:11 +02:00
parent cb209644dc
commit db24662cf1
10 changed files with 28 additions and 23 deletions

View File

@ -29,7 +29,7 @@ use phpOMS\Stdlib\Base\Exception\InvalidEnumValue;
* @link https://orange-management.org
* @since 1.0.0
*/
class NewsArticle implements ArrayableInterface, \JsonSerializable
class NewsArticle implements \JsonSerializable, ArrayableInterface
{
/**
* Article ID.

View File

@ -27,5 +27,6 @@ use phpOMS\Stdlib\Base\Enum;
abstract class NewsStatus extends Enum
{
public const VISIBLE = 0;
public const DRAFT = 1;
}

View File

@ -27,6 +27,8 @@ use phpOMS\Stdlib\Base\Enum;
abstract class NewsType extends Enum
{
public const ARTICLE = 0;
public const LINK = 1;
public const HEADLINE = 2;
}

View File

@ -25,8 +25,8 @@ $newsList = $this->getData('news') ?? [];
<thead>
<tr>
<td>
<td><?= $this->getHtml('Type', 'News') ?>
<td class="wf-100"><?= $this->getHtml('Title', 'News') ?>
<td><?= $this->getHtml('Type', 'News'); ?>
<td class="wf-100"><?= $this->getHtml('Title', 'News'); ?>
<tbody>
<?php $count = 0; foreach ($newsList as $key => $news) : ++$count;
$url = \phpOMS\Uri\UriFactory::build('{/prefix}news/article?{?}&id=' . $news->getId());
@ -42,13 +42,13 @@ $newsList = $this->getData('news') ?? [];
<i class="fa fa-star favorite"></i>
</a>
<?php endif; ?>
<td data-label="<?= $this->getHtml('Type', 'News') ?>">
<td data-label="<?= $this->getHtml('Type', 'News'); ?>">
<a href="<?= $url; ?>">
<span class="tag <?= $this->printHtml($color); ?>">
<?= $this->getHtml('TYPE' . $news->getType(), 'News') ?>
<?= $this->getHtml('TYPE' . $news->getType(), 'News'); ?>
</span>
</a>
<td data-label="<?= $this->getHtml('Title', 'News') ?>">
<td data-label="<?= $this->getHtml('Title', 'News'); ?>">
<a href="<?= $url; ?>">
<?= $this->printHtml($news->getTitle()); ?>
</a>

View File

@ -27,14 +27,14 @@ echo $this->getData('nav')->render(); ?>
<div class="row">
<div class="col-xs-12">
<section class="portlet">
<div class="portlet-head"><?= $this->getHtml('Archive') ?><i class="fa fa-download floatRight download btn"></i></div>
<div class="portlet-head"><?= $this->getHtml('Archive'); ?><i class="fa fa-download floatRight download btn"></i></div>
<table id="newsArchiveList" class="default">
<thead>
<tr>
<td><?= $this->getHtml('Type') ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
<td class="wf-100"><?= $this->getHtml('Title') ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
<td><?= $this->getHtml('Author') ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
<td><?= $this->getHtml('Date') ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
<td><?= $this->getHtml('Type'); ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
<td class="wf-100"><?= $this->getHtml('Title'); ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
<td><?= $this->getHtml('Author'); ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
<td><?= $this->getHtml('Date'); ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
<tbody>
<?php $count = 0; foreach ($articles as $key => $news) : ++$count; $url = UriFactory::build('{/prefix}news/article?{?}&id=' . $news->getId());
$color = 'darkred';
@ -43,7 +43,7 @@ echo $this->getData('nav')->render(); ?>
elseif ($news->getType() === NewsType::LINK) { $color = 'yellow'; }
?>
<tr tabindex="0" data-href="<?= $url; ?>">
<td><span class="tag <?= $this->printHtml($color); ?>"><?= $this->getHtml('TYPE' . $news->getType()) ?></span></a>
<td><span class="tag <?= $this->printHtml($color); ?>"><?= $this->getHtml('TYPE' . $news->getType()); ?></span></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($news->getTitle()); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($news->getCreatedBy()->getName1()); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($news->getPublish()->format('Y-m-d')); ?></a>

View File

@ -27,14 +27,14 @@ echo $this->getData('nav')->render(); ?>
<div class="row">
<div class="col-xs-12">
<section class="portlet">
<div class="portlet-head"><?= $this->getHtml('Draft') ?><i class="fa fa-download floatRight download btn"></i></div>
<div class="portlet-head"><?= $this->getHtml('Draft'); ?><i class="fa fa-download floatRight download btn"></i></div>
<table id="newsDraftList" class="default">
<thead>
<tr>
<td><?= $this->getHtml('Type') ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
<td class="wf-100"><?= $this->getHtml('Title') ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
<td><?= $this->getHtml('Author') ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
<td><?= $this->getHtml('Date') ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
<td><?= $this->getHtml('Type'); ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
<td class="wf-100"><?= $this->getHtml('Title'); ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
<td><?= $this->getHtml('Author'); ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
<td><?= $this->getHtml('Date'); ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
<tbody>
<?php $count = 0; foreach ($articles as $key => $news) : ++$count; $url = UriFactory::build('{/prefix}news/edit?{?}&id=' . $news->getId());
$color = 'darkred';
@ -43,7 +43,7 @@ echo $this->getData('nav')->render(); ?>
elseif ($news->getType() === NewsType::LINK) { $color = 'yellow'; }
?>
<tr tabindex="0" data-href="<?= $url; ?>">
<td><span class="tag <?= $this->printHtml($color); ?>"><?= $this->getHtml('TYPE' . $news->getType()) ?></span></a>
<td><span class="tag <?= $this->printHtml($color); ?>"><?= $this->getHtml('TYPE' . $news->getType()); ?></span></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($news->getTitle()); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($news->getCreatedBy()->getName1()); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($news->getPublish()->format('Y-m-d')); ?></a>

View File

@ -20,6 +20,7 @@ namespace Modules\News\tests\Admin;
class AdminTest extends \PHPUnit\Framework\TestCase
{
protected const MODULE_NAME = 'News';
protected const URI_LOAD = 'http://127.0.0.1/en/backend/news';
use \Modules\tests\ModuleTestTrait;

View File

@ -23,8 +23,8 @@ use phpOMS\Uri\HttpUri;
trait ApiControllerNewsArticleTrait
{
/**
* @testdox A news article can be created
* @covers Modules\News\Controller\ApiController
* @testdox A news article can be created
* @covers Modules\News\Controller\ApiController
* @group module
*/
public function testApiNewsCreate() : void

View File

@ -37,6 +37,7 @@ use phpOMS\Utils\TestUtils;
class ControllerTest extends \PHPUnit\Framework\TestCase
{
protected $app = null;
protected $module = null;
protected function setUp() : void

View File

@ -192,7 +192,7 @@ class NewsArticleTest extends \PHPUnit\Framework\TestCase
* @testdox A invalid status throws a InvalidEnumValue exception
* @covers Modules\News\Models\NewsArticle
* @group module
*/
*/
public function testInvalidStatus() : void
{
$this->expectException(\phpOMS\Stdlib\Base\Exception\InvalidEnumValue::class);
@ -205,7 +205,7 @@ class NewsArticleTest extends \PHPUnit\Framework\TestCase
* @testdox A invalid type throws a InvalidEnumValue exception
* @covers Modules\News\Models\NewsArticle
* @group module
*/
*/
public function testInvalidType() : void
{
$this->expectException(\phpOMS\Stdlib\Base\Exception\InvalidEnumValue::class);
@ -218,7 +218,7 @@ class NewsArticleTest extends \PHPUnit\Framework\TestCase
* @testdox A invalid language throws a InvalidEnumValue exception
* @covers Modules\News\Models\NewsArticle
* @group module
*/
*/
public function testInvalidLanguage() : void
{
$this->expectException(\phpOMS\Stdlib\Base\Exception\InvalidEnumValue::class);