parent
3505aafc39
commit
372bf351e3
@ -0,0 +1,31 @@ |
||||
<?php |
||||
|
||||
declare(strict_types=1); |
||||
|
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\Tests\CoreBundle\Controller; |
||||
|
||||
use Chamilo\Tests\ChamiloTestTrait; |
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; |
||||
use Symfony\Component\HttpFoundation\Response; |
||||
|
||||
class AccountControllerTest extends WebTestCase |
||||
{ |
||||
use ChamiloTestTrait; |
||||
|
||||
public function testEdit(): void |
||||
{ |
||||
$client = static::createClient(); |
||||
|
||||
// retrieve the admin |
||||
$admin = $this->getUser('admin'); |
||||
|
||||
// simulate $testUser being logged in |
||||
$client->loginUser($admin); |
||||
|
||||
$client->request('GET', '/account/edit'); |
||||
|
||||
$this->assertSame(Response::HTTP_OK, $client->getResponse()->getStatusCode()); |
||||
} |
||||
} |
||||
@ -0,0 +1,45 @@ |
||||
<?php |
||||
|
||||
declare(strict_types=1); |
||||
|
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\Tests\CoreBundle\Controller; |
||||
|
||||
use Chamilo\Tests\ChamiloTestTrait; |
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; |
||||
use Symfony\Component\HttpFoundation\Response; |
||||
|
||||
class CourseControllerTest extends WebTestCase |
||||
{ |
||||
use ChamiloTestTrait; |
||||
|
||||
public function testHomeRedirectAction(): void |
||||
{ |
||||
$client = static::createClient(); |
||||
$course = $this->createCourse('new'); |
||||
$admin = $this->getUser('admin'); |
||||
|
||||
// simulate $testUser being logged in |
||||
$client->loginUser($admin); |
||||
|
||||
$client->request('GET', '/course/'.$course->getCode().'/index.php'); |
||||
$this->assertResponseRedirects('/course/'.$course->getId().'/home'); |
||||
} |
||||
|
||||
public function testWelcomeAction(): void |
||||
{ |
||||
$client = static::createClient(); |
||||
$course = $this->createCourse('new course'); |
||||
$admin = $this->getUser('admin'); |
||||
|
||||
// simulate $testUser being logged in |
||||
$client->loginUser($admin); |
||||
|
||||
$client->request('GET', '/course/'.$course->getId().'/welcome'); |
||||
|
||||
$this->assertSame(Response::HTTP_OK, $client->getResponse()->getStatusCode()); |
||||
|
||||
$this->assertStringContainsString('new course', $client->getResponse()->getContent()); |
||||
} |
||||
} |
||||
@ -0,0 +1,29 @@ |
||||
<?php |
||||
|
||||
declare(strict_types=1); |
||||
|
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\Tests\CoreBundle\Controller; |
||||
|
||||
use Chamilo\Tests\ChamiloTestTrait; |
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; |
||||
|
||||
class ToolControllerTest extends WebTestCase |
||||
{ |
||||
use ChamiloTestTrait; |
||||
|
||||
public function testToolUpdate(): void |
||||
{ |
||||
$client = static::createClient(); |
||||
$admin = $this->getUser('admin'); |
||||
|
||||
// simulate $testUser being logged in |
||||
$client->loginUser($admin); |
||||
|
||||
$client->request('GET', '/tool/update'); |
||||
|
||||
$this->assertResponseIsSuccessful(); |
||||
$this->assertStringContainsString('Updated', $client->getResponse()->getContent()); |
||||
} |
||||
} |
||||
Loading…
Reference in new issue