Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal: Test/UI #266

Merged
merged 43 commits into from
Dec 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
083f121
feat: Enable xml and dom to test html
KminekMatej Sep 27, 2024
61a7954
feat: UI autotest for Discussion list and discussion details R/W
KminekMatej Sep 29, 2024
7a798d8
feat: Upgrade phpDoc
KminekMatej Sep 29, 2024
76bfaf2
feat: Recomposed
KminekMatej Sep 29, 2024
19a4c82
feat: Fixing php stan
KminekMatej Dec 7, 2024
bc90d9b
feat: Coding style
KminekMatej Dec 7, 2024
bac666f
feat: Upgrade dependencies, increase phpoffice to version 3.x
KminekMatej Dec 7, 2024
d75b473
feat: Fix uses
KminekMatej Dec 7, 2024
b4c8eea
feat: Rename tests to improve readability
KminekMatej Dec 7, 2024
de2b987
feat: Move UI tests from module Event
KminekMatej Dec 7, 2024
a45d9e2
feat: Rename presenter class to match filename
KminekMatej Dec 7, 2024
d779d86
feat: Create parent function for obtaining DOM structure
KminekMatej Dec 7, 2024
3b5a2e4
feat: Be able to pass aditional params
KminekMatej Dec 7, 2024
901f401
feat: Use parent dom obtainer
KminekMatej Dec 7, 2024
c0c9a4b
feat: Align to UITest
KminekMatej Dec 7, 2024
d781ec9
feat: UI Test renaming to improve readbility
KminekMatej Dec 7, 2024
a524807
feat: UI Test renaming to improve readbility
KminekMatej Dec 7, 2024
6da1d9f
feat: Separate list and detail tests on Event module
KminekMatej Dec 7, 2024
d9a658f
feat: Replace TAPI logins by internal authentication - prepare to glo…
KminekMatej Dec 7, 2024
f1f7aa3
feat: Add type assertion for phpstan internal purposes
KminekMatej Dec 7, 2024
6094ab7
feat: Add deleting functions
KminekMatej Dec 7, 2024
f78d0b3
feat: Delete discussion after creation and testing
KminekMatej Dec 7, 2024
01cac6e
feat: Event detail autotest fixes
KminekMatej Dec 7, 2024
2c215e5
feat: Coding style
KminekMatej Dec 7, 2024
6564c05
feat: Use this->presenter and presenter name from abstracted functions
KminekMatej Dec 7, 2024
3a93c2c
feat: Polls and Poll UI autotest
KminekMatej Dec 7, 2024
1eabb91
feat: Team test + Automatic hyperlink tester
KminekMatej Dec 7, 2024
64b5e2a
feat: Refactor UI breadcrumbs due to breadcrumb outputs
KminekMatej Dec 7, 2024
6a8aff6
feat: Reorder logically
KminekMatej Dec 7, 2024
5f1b3c1
feat: Use parent breadcrumb tester everywhere
KminekMatej Dec 7, 2024
748a16c
feat: Delete create users
KminekMatej Dec 7, 2024
0135efb
feat: UI test of team with environment locking to prevent collisions
KminekMatej Dec 7, 2024
99869ea
feat: Add gitattributes formatting file
KminekMatej Dec 7, 2024
1af8509
feat: Coding style
KminekMatej Dec 7, 2024
ad421b1
feat: Use parent navbar tester
KminekMatej Dec 7, 2024
48f68c1
feat: Rm unused variables
KminekMatej Dec 7, 2024
de48855
feat: Rm old tests folder
KminekMatej Dec 7, 2024
d084e9d
feat: Move tests out of module into separate tests folder
KminekMatej Dec 7, 2024
c7d4f4d
feat: Rm tests router
KminekMatej Dec 7, 2024
f846d42
feat: Add tests to phpstan
KminekMatej Dec 7, 2024
a39d860
feat: Neccessary updates to make tests work
KminekMatej Dec 7, 2024
6efcbd3
feat: Fix paths
KminekMatej Dec 7, 2024
b9c04b4
feat: Fix TESTDIR
KminekMatej Dec 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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