diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..5a0d5e480 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto eol=lf diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7ac180fea..441c0f9f5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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" diff --git a/app/Bootstrap.php b/app/Bootstrap.php index 83c0e9bc5..79f355cdd 100644 --- a/app/Bootstrap.php +++ b/app/Bootstrap.php @@ -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"], "."))]); diff --git a/app/module/autotest/app/discussion/DiscussionPresenterTest.phpt b/app/module/autotest/app/discussion/DiscussionPresenterTest.phpt deleted file mode 100644 index b11b1e58a..000000000 --- a/app/module/autotest/app/discussion/DiscussionPresenterTest.phpt +++ /dev/null @@ -1,94 +0,0 @@ -authorizeUser(); - $request = new Nette\Application\Request($this->getPresenterName(), 'GET', array('action' => 'default')); - $response = $this->presenter->run($request); - - Assert::type('Nette\Application\Responses\TextResponse', $response); - - $html = (string) $response->getSource(); - $dom = DomQuery::fromHtml($html); - - //has navbar - Assert::true($dom->has('div#snippet-navbar-nav')); - //has breadcrumbs - Assert::true($dom->has('div.container')); - Assert::true($dom->has('ol.breadcrumb')); - Assert::equal(count($dom->find('ol.breadcrumb li.breadcrumb-item a[href]')), 1); - Assert::equal(count($dom->find('ol.breadcrumb li.breadcrumb-item')), 2); //last item aint link - - Assert::true($dom->has('div.container.discussions')); - Assert::true(count($dom->find('div.container.discussions div.row')) >= 1); - } - - function testActionDiscussion($discussionName, $canWrite) - { - $this->authorizeAdmin(); - $discussion = $this->recordManager->createDiscussion(); - $discussionName = $discussion["name"]; - - $this->authorizeUser(); - $request = new Nette\Application\Request($this->getPresenterName(), 'GET', ['action' => 'discussion', 'discussion' => $discussionName]); - $response = $this->presenter->run($request); - - Assert::type('Nette\Application\Responses\TextResponse', $response); - - $re = '/&(?!(?:apos|quot|[gl]t|amp);|#)/'; - - $dom = NULL; - $html = (string)$response->getSource(); - //replace unescaped ampersands in html to prevent tests from failing - $html = preg_replace($re, "&", $html); - - $dom = DomQuery::fromHtml($html); - //has navbar - Assert::true($dom->has('div#snippet-navbar-nav')); - - //has breadcrumbs - - Assert::true($dom->has('div.container div.row div.col ol.breadcrumb')); - Assert::equal(count($dom->find('ol.breadcrumb li.breadcrumb-item a[href]')), 2); - Assert::equal(count($dom->find('ol.breadcrumb li.breadcrumb-item')), 3); //last item aint link - - Assert::equal(count($dom->find('div.container.my-2 div.row.justify-content-md-center')), $canWrite ? 2 : 1); - if($canWrite){ - Assert::true($dom->has('div.container.my-2 div.row.justify-content-md-center div.col-md-10 textarea#addPost')); - Assert::true($dom->has('div.container.my-2 div.row.justify-content-md-center div.col-md-10 div.addPost form.form-inline input.form-control.mr-sm-2')); - Assert::true($dom->has('div.container.my-2 div.row.justify-content-md-center div.col-md-10 div.addPost form.form-inline span.mr-auto input.form-control.btn.btn-outline-success.mr-sm-2')); - Assert::true($dom->has('div.container.my-2 div.row.justify-content-md-center div.col-md-10 div.addPost form.form-inline button.btn.btn-primary')); - } - - Assert::true($dom->has('div.container.discussion#snippet--discussion')); - Assert::true(count($dom->find('div.container.discussion#snippet--discussion div.row'))<=20); - } - - protected function getPresenterName(): string - { - return "Discussion:Default"; - } - - public function getModule(): string - { - return "Discussion"; - } -} - -(new DiscussionPresenterTest($container))->run(); diff --git a/app/module/autotest/entity/UITest.php b/app/module/autotest/entity/UITest.php deleted file mode 100644 index b6fddb909..000000000 --- a/app/module/autotest/entity/UITest.php +++ /dev/null @@ -1,23 +0,0 @@ -getPresenterName() != "undefined") { - $this->presenter = $this->presenterFactory->createPresenter($this->getPresenterName()); - $this->presenter->autoCanonicalize = false; - } - - parent::setUp(); - } - -} diff --git a/app/module/autotest/php.ini b/app/module/autotest/php.ini deleted file mode 100644 index 54e0a7b04..000000000 --- a/app/module/autotest/php.ini +++ /dev/null @@ -1,30 +0,0 @@ -extension=pdo.so -extension=curl.so -extension=mysqlnd.so -extension=pdo_mysql.so -extension=pdo_sqlite.so -extension=tokenizer.so -extension=gmp.so -extension=fileinfo.so -extension=gd.so -extension=iconv.so -extension=sqlite3 -extension=intl.so -extension=mbstring.so -;extension=xml.so -;extension=dom.so -extension=simplexml.so -extension=igbinary.so -;extension=msgpack.so -;igbinary.compact_strings=On -;extension=memcache.so -;extension=memcached.so -memcached.serializer=php -session.gc_probability = 0 -output_buffering=Off - -max_execution_time=300 -max_input_time=300 -upload_max_filesize=2G -post_max_size=256M -memory_limit=1024M diff --git a/app/module/autotest/router/Router.php b/app/module/autotest/router/Router.php deleted file mode 100644 index 80bb6e660..000000000 --- a/app/module/autotest/router/Router.php +++ /dev/null @@ -1,17 +0,0 @@ -addRoute('autotest[/]', ['module' => 'Autotest', 'presenter' => 'Default', 'action' => 'default']); - } -} diff --git a/app/module/autotest/setup.php b/app/module/autotest/setup.php deleted file mode 100644 index a3e5957de..000000000 --- a/app/module/autotest/setup.php +++ /dev/null @@ -1,20 +0,0 @@ -setEnvironmentVariable("AUTOTEST", true); -} diff --git a/app/module/core/component/templates/blocks/report.latte b/app/module/core/component/templates/blocks/report.latte index f6a6fcd1a..3e1ce99d7 100644 --- a/app/module/core/component/templates/blocks/report.latte +++ b/app/module/core/component/templates/blocks/report.latte @@ -1,4 +1,4 @@ -