Skip to content

Commit

Permalink
Merge pull request #266 from KminekMatej/test/ui
Browse files Browse the repository at this point in the history
Internal: Test/UI
  • Loading branch information
KminekMatej authored Dec 7, 2024
2 parents db9b4c6 + b9c04b4 commit 7c302d9
Show file tree
Hide file tree
Showing 74 changed files with 1,061 additions and 2,115 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto eol=lf
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
DBNAME: autotest
DBUSER: drtikol
DBPWD: w,6TmB
TESTDIR: app/module/autotest
TESTDIR: tests
AUTOTEST: 1
steps:
- name: "Mock database environment"
Expand Down
3 changes: 3 additions & 0 deletions app/Bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ public static function boot(): Container

$configurator->addConfig(TEAM_DIR . '/app/config/config.neon');
$configurator->addConfig(TEAM_DIR . '/local/' . ($autotestMode ? 'config.autotest.neon' : 'config.neon'));
if ($autotestMode) {
$configurator->addConfig(TEAM_DIR . '/tests/config/config.neon');
}

$configurator->addParameters(["team" => getenv("team") ?: substr($_SERVER["HTTP_HOST"], 0, strpos($_SERVER["HTTP_HOST"], "."))]);

Expand Down
94 changes: 0 additions & 94 deletions app/module/autotest/app/discussion/DiscussionPresenterTest.phpt

This file was deleted.

23 changes: 0 additions & 23 deletions app/module/autotest/entity/UITest.php

This file was deleted.

30 changes: 0 additions & 30 deletions app/module/autotest/php.ini

This file was deleted.

17 changes: 0 additions & 17 deletions app/module/autotest/router/Router.php

This file was deleted.

20 changes: 0 additions & 20 deletions app/module/autotest/setup.php

This file was deleted.

2 changes: 1 addition & 1 deletion app/module/core/component/templates/blocks/report.latte
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<li class="nav-item dropdown" name="polls">
<li class="nav-item dropdown" name="reports">
<a class="nav-link" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><i class="fa fa-scroll" aria-hidden="true"></i> {_report.report,2}</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<a class="dropdown-item" href="{plink :Event:Export:}">{_event.attendance, 1}</a>
Expand Down
35 changes: 17 additions & 18 deletions app/module/team/presenter/front/DefaultPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

class DefaultPresenter extends SecuredPresenter
{
private string $userType;

public function beforeRender(): void
{
parent::beforeRender();
Expand Down Expand Up @@ -41,41 +39,42 @@ public function beforeRender(): void

return count($errFields);
});
}

$this->addBreadcrumb($this->translator->translate("team.team", 1), $this->link(":Team:Default:"));
public function renderDefault(): void
{
$this->addBreadcrumb($this->translator->translate("common.everyone"), $this->link(":Team:Default:"));
$this->statusRender();
}

public function actionPlayers(): void
public function renderPlayers(): void
{
$this->addBreadcrumb($this->translator->translate("team.PLAYER", 2), $this->link(":Team:Default:players"));
$this->userType = "PLAYER";
$this->setView('default');
$this->statusRender("PLAYER");
}

public function actionMembers(): void
public function renderMembers(): void
{
$this->addBreadcrumb($this->translator->translate("team.MEMBER", 2), $this->link(":Team:Default:members"));
$this->userType = "MEMBER";
$this->setView('default');
$this->statusRender("MEMBER");
}

public function actionSicks(): void
public function renderSicks(): void
{
$this->addBreadcrumb($this->translator->translate("team.SICK", 2), $this->link(":Team:Default:sicks"));
$this->userType = "SICK";
$this->setView('default');
$this->statusRender("SICK");
}

public function actionInits(): void
public function renderInits(): void
{
$this->addBreadcrumb($this->translator->translate("team.INIT", 2), $this->link(":Team:Default:inits"));
$this->userType = "INIT";
$this->setView('default');
$this->statusRender("INIT");
}

public function renderDefault(): void
private function statusRender(?string $userStatus = null): void
{
$users = isset($this->userType) ? $this->userManager->getByStatus($this->userType) : $this->userManager->getList();
$this->setView('default');
$users = $userStatus ? $this->userManager->getByStatus($userStatus) : $this->userManager->getList();
$allMails = [];
if ($users !== []) {
foreach ($users as $u) {
Expand All @@ -88,7 +87,7 @@ public function renderDefault(): void
$this->flashMessage($this->translator->translate("common.alerts.nobodyFound") . "!");
}

$this->template->userType = $this->userType ?? null;
$this->template->userType = $userStatus;
$this->template->users = $users;
$this->template->allMails = implode(",", $allMails);
}
Expand Down
10 changes: 5 additions & 5 deletions bin/tester.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
use PDOException;
use Tymy\Bootstrap;
use Tymy\Module\Admin\Manager\MigrationManager;
use Tymy\Module\Autotest\Manager\MockMailer;
use Tymy\Module\Autotest\MockRequestFactory;
use Tymy\Test\Manager\MockMailer;
use Tymy\Test\MockRequestFactory;

use const ROOT_DIR;
use const TEST_DIR;
Expand Down Expand Up @@ -47,7 +47,7 @@ public function __construct()
{
define("ROOT_DIR", FileSystem::normalizePath(Common::getCwdUnresolved() . "/.."));
define("TEAM_DIR", ROOT_DIR);
define("TEST_DIR", ROOT_DIR . "/app/module/autotest");
define("TEST_DIR", ROOT_DIR . "/tests");
putenv("team=autotest");
$this->configFile = ROOT_DIR . "/local/config.neon";
$this->autotestConfigFile = ROOT_DIR . "/local/config.autotest.neon";
Expand Down Expand Up @@ -353,7 +353,7 @@ private function createAutotestConfigFile(array $configuration, string $dbHost,
private function symlinkTestDir()
{
$symlink = __DIR__ . "/tests";
$target = "../app/module/autotest/app";
$target = "../tests/app";

$this->logg("Creating symlink $symlink to $target directory");

Expand All @@ -365,7 +365,7 @@ private function rmTestsSymlink()
{
$symlink = __DIR__ . "/tests";
if (file_exists($symlink) && is_link($symlink)) {
$target = "../app/module/autotest/app";
$target = "../tests/app";
$this->logg("Removing symlink $symlink to $target directory");
unlink($symlink);
$this->logg("Symlink succesfully removed");
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"lcobucci/jwt": "4.1.5",
"vojir/nette-csv-response": "v1.2",
"contributte/sentry": "^0.3.0",
"phpoffice/phpspreadsheet": "^2"
"phpoffice/phpspreadsheet": "^3"
},
"suggest": {
"ext-memcached": "To use Memcached as CacheStorage (default for tymy.cz). If you dont want to use MemCached, override cache storage in your local/config.neon"
Expand All @@ -55,7 +55,7 @@
"classmap": ["app/"]
},
"autoload-dev": {
"classmap": ["app/"]
"classmap": ["app/", "tests/"]
},
"minimum-stability": "stable",
"config": {
Expand Down
Loading

0 comments on commit 7c302d9

Please sign in to comment.