parent
36c0f6bf01
commit
3d3d69beb1
@ -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 NewsControllerTest extends WebTestCase |
||||
{ |
||||
use ChamiloTestTrait; |
||||
|
||||
public function testIndex(): void |
||||
{ |
||||
$client = static::createClient(); |
||||
|
||||
// retrieve the admin |
||||
$admin = $this->getUser('admin'); |
||||
|
||||
// simulate $testUser being logged in |
||||
$client->loginUser($admin); |
||||
|
||||
$client->request('GET', '/news/list'); |
||||
$this->assertResponseIsSuccessful(); |
||||
} |
||||
} |
||||
@ -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; |
||||
|
||||
class UserControllerTest extends WebTestCase |
||||
{ |
||||
use ChamiloTestTrait; |
||||
|
||||
public function testIndex(): void |
||||
{ |
||||
$client = static::createClient(); |
||||
|
||||
// retrieve the admin |
||||
$admin = $this->getUser('admin'); |
||||
|
||||
// simulate $testUser being logged in |
||||
$client->loginUser($admin); |
||||
|
||||
$client->request('GET', '/user/admin'); |
||||
$this->assertResponseIsSuccessful(); |
||||
|
||||
$this->assertSelectorTextContains('#sectionMainContent', 'admin'); |
||||
} |
||||
} |
||||
@ -0,0 +1,43 @@ |
||||
<?php |
||||
|
||||
declare(strict_types=1); |
||||
|
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\Tests\CourseBundle\Repository; |
||||
|
||||
use Chamilo\CourseBundle\Entity\CCourseDescription; |
||||
use Chamilo\CourseBundle\Repository\CCourseDescriptionRepository; |
||||
use Chamilo\Tests\AbstractApiTest; |
||||
use Chamilo\Tests\ChamiloTestTrait; |
||||
|
||||
class CCourseDescriptionRepositoryTest extends AbstractApiTest |
||||
{ |
||||
use ChamiloTestTrait; |
||||
|
||||
public function testCreate(): void |
||||
{ |
||||
self::bootKernel(); |
||||
|
||||
$em = $this->getEntityManager(); |
||||
$repo = self::getContainer()->get(CCourseDescriptionRepository::class); |
||||
|
||||
$course = $this->createCourse('new'); |
||||
$teacher = $this->createUser('teacher'); |
||||
|
||||
$item = (new CCourseDescription()) |
||||
->setTitle('title') |
||||
->setContent('content') |
||||
->setDescriptionType(1) |
||||
->setProgress(100) |
||||
->setParent($course) |
||||
->setCreator($teacher) |
||||
; |
||||
$this->assertHasNoEntityViolations($item); |
||||
$em->persist($item); |
||||
$em->flush(); |
||||
|
||||
$this->assertSame('title', (string) $item); |
||||
$this->assertSame(1, $repo->count([])); |
||||
} |
||||
} |
||||
Loading…
Reference in new issue