Skip to content
Snippets Groups Projects
Commit 7616560c authored by Marcus Eibrink-Lunzenauer's avatar Marcus Eibrink-Lunzenauer
Browse files

Merge branch 'tic-11652' into 'main'

Update von Codeception und phpunit

See merge request studip/studip!23
parents cf997f4c 607b1e07
No related branches found
No related tags found
No related merge requests found
Showing
with 2756 additions and 1271 deletions
This diff is collapsed.
......@@ -5,7 +5,7 @@ namespace Helper;
use Codeception\Exception\ModuleConfigException;
use Codeception\Exception\ModuleException;
require_once 'StudipPDO.php';
require_once('lib/classes/StudipPDO.class.php');
class StudipDb extends \Codeception\Module
{
......
<?php //[STAMP] 6e8eab5089e8fcc600b23f9a78b89b9c
<?php //[STAMP] 9862bb9e5ebf65fc43909feeee411c2a
namespace _generated;
// This class was automatically generated by build task
......
This diff is collapsed.
This diff is collapsed.
......@@ -42,7 +42,7 @@ class UserEventsIcalTest extends \Codeception\Test\Unit
$response = $app($requestBuilder->getRequest(), new \Slim\Http\Response());
$this->tester->assertEquals(200, $response->getStatusCode());
$this->tester->assertContains('BEGIN:VEVENT', (string) $response->getBody());
$this->tester->assertContains('SUMMARY:blypyp', (string) $response->getBody());
$this->tester->assertStringContainsString('BEGIN:VEVENT', (string) $response->getBody());
$this->tester->assertStringContainsString('SUMMARY:blypyp', (string) $response->getBody());
}
}
......@@ -55,6 +55,7 @@ class WikiCreateTest extends \Codeception\Test\Unit
'/courses/{id}/wiki',
WikiCreate::class
);
$app->get('/wiki-pages/{id}', function () {})->setName('get-wiki-page');
return $this->tester->sendMockRequest(
$app,
......
......@@ -23,7 +23,7 @@ class WikiIndexTest extends \Codeception\Test\Unit
{
$credentials = $this->tester->getCredentialsForTestAutor();
$rangeId = 'a07535cf2f8a72df33c12ddfa4b53dde';
$body = studip_utf8decode('Es gibt im Moment in diese Mannschaft, oh, einige Spieler vergessen ihren Profi was sie sind. Ich lese nicht sehr viele Zeitungen, aberich habe gehört viele Situationen. Erstens: Wir haben nicht offensivgespielt.');
$body = 'Es gibt im Moment in diese Mannschaft, oh, einige Spieler vergessen ihren Profi was sie sind. Ich lese nicht sehr viele Zeitungen, aberich habe gehört viele Situationen. Erstens: Wir haben nicht offensivgespielt.';
$this->createWikiPage($credentials['id'], $rangeId, 'yxilo', $body);
$this->createWikiPage($credentials['id'], $rangeId, 'ulyq', $body);
......@@ -37,7 +37,7 @@ class WikiIndexTest extends \Codeception\Test\Unit
$this->tester->assertCount(count($countPages), $wikiPages);
$wikiPage = current($wikiPages);
$this->tester->assertEquals($body, studip_utf8decode($wikiPage->attribute('content')));
$this->tester->assertEquals($body, $wikiPage->attribute('content'));
$this->tester->storeJsonMd('get_wiki_pages', $response, 2, '[...]');
}
......@@ -46,6 +46,7 @@ class WikiIndexTest extends \Codeception\Test\Unit
private function getWikiIndex($credentials, $rangeId)
{
$app = $this->tester->createApp($credentials, 'get', '/courses/{id}/wiki', WikiIndex::class);
$app->get('/wiki-pages/{id}', function () {})->setName('get-wiki-page');
return $this->tester->sendMockRequest(
$app,
......
......@@ -55,7 +55,7 @@ class WikiShowTest extends \Codeception\Test\Unit
private function createWikiPage($rangeId, $keyword, $body)
{
$wikiPage = new \WikiPage([$rangeId, $keyword, 0]);
$wikiPage->body = studip_utf8decode($body);
$wikiPage->body = $body;
$wikiPage->user_id = 'nobody';
$wikiPage->store();
......
......@@ -48,6 +48,7 @@ class WikiUpdateTest extends \Codeception\Test\Unit
],
];
$app = $this->tester->createApp($credentials, 'patch', '/wiki-pages/{id}', WikiUpdate::class);
$app->get('/wiki-pages/{id}', function () {})->setName('get-wiki-page');
return $this->tester->sendMockRequest(
$app,
......@@ -62,7 +63,7 @@ class WikiUpdateTest extends \Codeception\Test\Unit
private function createWikiPage($rangeId, $keyword, $body)
{
$wikiPage = new \WikiPage([$rangeId, $keyword, 0]);
$wikiPage->body = studip_utf8decode($body);
$wikiPage->body = $body;
$wikiPage->user_id = 'nobody';
$wikiPage->store();
......
......@@ -38,8 +38,13 @@ require_once 'varstream.php';
define("TEST_FIXTURES_PATH", dirname(__DIR__) . "/_data/");
require __DIR__ . '/../../composer/autoload.php';
global $STUDIP_BASE_PATH;
$STUDIP_BASE_PATH = realpath(dirname(dirname(__FILE__)) . '/..');
require 'lib/classes/StudipAutoloader.php';
require 'lib/functions.php';
require 'lib/visual.inc.php';
StudipAutoloader::setBasePath(realpath(__DIR__ . '/../..'));
StudipAutoloader::register();
......
......@@ -14,11 +14,11 @@ require_once 'lib/calendar/CalendarColumn.class.php';
class CalendarColumnCase extends \Codeception\Test\Unit {
function setUp() {
function setUp(): void {
}
function tearDown() {
function tearDown(): void {
}
......@@ -62,11 +62,11 @@ class CalendarColumnCase extends \Codeception\Test\Unit {
$entry = ['start' => "1200", 'end' => "1230", 'title' => "test_title_number_2"];
$column->addEntry($entry);
$entries = $column->getEntries();
$this->assertInternalType("array", $entries);
$this->assertIsArray($entries);
$this->assertEquals(2, count($entries));
$this->assertNotEquals($entries[0], $entry);
$this->assertEquals($entry, $entries[1]);
$this->assertInternalType("array", $entries[1]);
$this->assertIsArray($entries[1]);
}
function test_wrong_entry() {
......@@ -85,7 +85,7 @@ class CalendarColumnCase extends \Codeception\Test\Unit {
['start' => "1200", 'end' => "1400", 'title' => "test_title"]
];
$column = CalendarColumn::create()->addEntries($entries);
$this->assertInternalType('array', $column->getEntries());
$this->assertIsArray($column->getEntries());
}
function test_erase_entries() {
......@@ -93,7 +93,7 @@ class CalendarColumnCase extends \Codeception\Test\Unit {
$column = CalendarColumn::create()->addEntry($entry);
$column->eraseEntries();
$entries = $column->getEntries();
$this->assertInternalType("array", $entries);
$this->assertIsArray($entries);
$this->assertEquals(0, count($entries));
}
......
......@@ -14,11 +14,11 @@ require_once 'lib/calendar/CalendarView.class.php';
class CalendarViewCase extends \Codeception\Test\Unit {
function setUp() {
function setUp(): void {
}
function tearDown() {
function tearDown(): void {
}
......@@ -56,7 +56,7 @@ class CalendarViewCase extends \Codeception\Test\Unit {
$id2 = 4;
$view->addColumn($title2, "", $id2);
$columns = $view->getColumns();
$this->assertInternalType("array", $columns);
$this->assertIsArray($columns);
$this->assertInstanceOf("CalendarColumn", $columns[0]);
$this->assertEquals($title1, $columns[0]->getTitle());
$this->assertEquals($id1, $columns[0]->getId());
......@@ -87,7 +87,7 @@ class CalendarViewCase extends \Codeception\Test\Unit {
];
$view->addEntry($entry);
$entries = $view->getEntries();
$this->assertInternalType("array", $entries);
$this->assertIsArray($entries);
$this->assertNotNull($entries['day_'.$id]);
}
......@@ -101,5 +101,3 @@ class CalendarViewCase extends \Codeception\Test\Unit {
//Die anderen Methoden muss Till testen.
}
......@@ -17,7 +17,7 @@ require_once 'lib/classes/SmileyFormat.php';
class VisualFunctionsTest extends \Codeception\Test\Unit
{
public function setUp()
public function setUp(): void
{
static $config = [
'LOAD_EXTERNAL_MEDIA' => 'allow',
......@@ -30,7 +30,7 @@ class VisualFunctionsTest extends \Codeception\Test\Unit
$GLOBALS['SYMBOL_SHORT'] = [];
}
public function tearDown()
public function tearDown(): void
{
$GLOBALS['SMILEY_NO_DB'] = false;
}
......
......@@ -26,12 +26,12 @@ define('DYNAMIC_ASSETS_URL', 'http://www%d.example.com/public/');
class AssetsTestCase extends \Codeception\Test\Unit {
function setUp() {
function setUp(): void {
Assets::set_assets_url(STATIC_ASSETS_URL);
}
function tearDown() {
function tearDown(): void {
Assets::set_assets_url('');
}
......@@ -57,12 +57,12 @@ class DynamicAssetsTestCase extends \Codeception\Test\Unit
{
function setUp() {
function setUp(): void {
Assets::set_assets_url(DYNAMIC_ASSETS_URL);
}
function tearDown() {
function tearDown(): void {
Assets::set_assets_url('');
}
......@@ -90,12 +90,12 @@ class AssetsHelpersTestCase extends \Codeception\Test\Unit
{
function setUp() {
function setUp(): void {
Assets::set_assets_url(STATIC_ASSETS_URL);
}
function tearDown() {
function tearDown(): void {
Assets::set_assets_url('');
}
......
......@@ -22,7 +22,7 @@ require_once 'lib/phplib/Seminar_Perm.class.php';
*/
class AvatarTestCase extends \Codeception\Test\Unit {
function setUp()
function setUp(): void
{
$stub = $this->createMock('Seminar_Perm');
// Configure the stub.
......@@ -37,7 +37,7 @@ class AvatarTestCase extends \Codeception\Test\Unit {
$this->avatar = Avatar::getAvatar($this->avatar_id);
}
function tearDown() {
function tearDown(): void {
unset($GLOBALS['DYNAMIC_CONTENT_PATH'], $GLOBALS['DYNAMIC_CONTENT_URL']);
}
......@@ -70,7 +70,7 @@ class AvatarTestCase extends \Codeception\Test\Unit {
class CourseAvatarTestCase extends \Codeception\Test\Unit
{
function setUp() {
function setUp(): void {
$this->avatar_id = "123456789";
$this->avatar = CourseAvatar::getAvatar($this->avatar_id);
......@@ -96,7 +96,7 @@ class CourseAvatarTestCase extends \Codeception\Test\Unit
}
}
function tearDown() {
function tearDown(): void {
stream_wrapper_unregister("var");
unset($GLOBALS['DYNAMIC_CONTENT_PATH'], $GLOBALS['DYNAMIC_CONTENT_URL']);
}
......
......@@ -14,14 +14,14 @@ class CronjobTestSchedule extends SimpleORMap
class CronjobScheduleTest extends \Codeception\Test\Unit
{
function setUp()
function setUp(): void
{
date_default_timezone_set('Europe/Berlin');
StudipTestHelper::set_up_tables(['cronjobs_schedules', 'cronjobs_tasks']);
}
function tearDown()
function tearDown(): void
{
StudipTestHelper::tear_down_tables();
}
......
......@@ -12,7 +12,7 @@
class CSRFProtectionTokenTest extends \Codeception\Test\Unit
{
function setUp()
function setUp(): void
{
if (session_id() === '') {
session_id("test-session");
......@@ -21,7 +21,7 @@ class CSRFProtectionTokenTest extends \Codeception\Test\Unit
$_SESSION = [];
}
function tearDown()
function tearDown(): void
{
$_SESSION = $this->original_session;
}
......@@ -52,7 +52,7 @@ class CSRFProtectionTokenTest extends \Codeception\Test\Unit
function testTokenIsAString()
{
$token = CSRFProtection::token();
$this->assertInternalType("string", $token);
$this->assertIsString($token);
}
function testTokenTag()
......@@ -65,7 +65,7 @@ class CSRFProtectionTokenTest extends \Codeception\Test\Unit
class CSRFRequestTest extends \Codeception\Test\Unit
{
function setUp()
function setUp(): void
{
if (session_id() === '') {
session_id("test-session");
......@@ -77,7 +77,7 @@ class CSRFRequestTest extends \Codeception\Test\Unit
$_SERVER['HTTP_X_REQUESTED_WITH'] = null;
}
function tearDown()
function tearDown(): void
{
list($_SESSION, $_POST, $_SERVER) = $this->original_state;
}
......
......@@ -10,13 +10,13 @@
class IconClassTest extends \Codeception\Test\Unit
{
function setUp()
function setUp(): void
{
$this->memo_assets_url = Assets::url();
Assets::set_assets_url('');
}
function tearDown()
function tearDown(): void
{
Assets::set_assets_url($this->memo_assets_url);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment