parent
30c8cfed91
commit
0ccaf0a888
@ -0,0 +1,37 @@ |
||||
<?php |
||||
|
||||
declare(strict_types=1); |
||||
|
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\Tests\CoreBundle\Repository; |
||||
|
||||
use Chamilo\CoreBundle\Entity\Language; |
||||
use Chamilo\CoreBundle\Repository\LanguageRepository; |
||||
use Chamilo\Tests\AbstractApiTest; |
||||
use Chamilo\Tests\ChamiloTestTrait; |
||||
|
||||
class LanguageRepositoryTest extends AbstractApiTest |
||||
{ |
||||
use ChamiloTestTrait; |
||||
|
||||
public function testCreate(): void |
||||
{ |
||||
self::bootKernel(); |
||||
|
||||
$em = $this->getManager(); |
||||
$repo = self::getContainer()->get(LanguageRepository::class); |
||||
$defaultCount = $repo->count([]); |
||||
$item = (new Language()) |
||||
->setAvailable(true) |
||||
->setOriginalName('language') |
||||
->setEnglishName('language') |
||||
->setIsocode('lan') |
||||
; |
||||
$this->assertHasNoEntityViolations($item); |
||||
$em->persist($item); |
||||
$em->flush(); |
||||
|
||||
$this->assertSame($defaultCount + 1, $repo->count([])); |
||||
} |
||||
} |
@ -0,0 +1,45 @@ |
||||
<?php |
||||
|
||||
declare(strict_types=1); |
||||
|
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\Tests\CoreBundle\Repository; |
||||
|
||||
use Chamilo\CoreBundle\Entity\Career; |
||||
use Chamilo\CoreBundle\Entity\Promotion; |
||||
use Chamilo\CoreBundle\Repository\PromotionRepository; |
||||
use Chamilo\Tests\AbstractApiTest; |
||||
use Chamilo\Tests\ChamiloTestTrait; |
||||
|
||||
class PromotionRepositoryTest extends AbstractApiTest |
||||
{ |
||||
use ChamiloTestTrait; |
||||
|
||||
public function testCreate(): void |
||||
{ |
||||
self::bootKernel(); |
||||
|
||||
$em = $this->getManager(); |
||||
$repo = self::getContainer()->get(PromotionRepository::class); |
||||
$defaultCount = $repo->count([]); |
||||
|
||||
$career = (new Career()) |
||||
->setName('Doctor') |
||||
; |
||||
$em->persist($career); |
||||
$em->flush(); |
||||
|
||||
$item = (new Promotion()) |
||||
->setName('2000') |
||||
->setDescription('Promotion of 2000') |
||||
->setCareer($career) |
||||
->setStatus(1) |
||||
; |
||||
$this->assertHasNoEntityViolations($item); |
||||
$em->persist($item); |
||||
$em->flush(); |
||||
|
||||
$this->assertSame($defaultCount + 1, $repo->count([])); |
||||
} |
||||
} |
@ -0,0 +1,47 @@ |
||||
<?php |
||||
|
||||
declare(strict_types=1); |
||||
|
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\Tests\CoreBundle\Repository; |
||||
|
||||
use Chamilo\CoreBundle\Entity\ExtraField; |
||||
use Chamilo\CoreBundle\Entity\Tag; |
||||
use Chamilo\CoreBundle\Repository\TagRepository; |
||||
use Chamilo\Tests\AbstractApiTest; |
||||
use Chamilo\Tests\ChamiloTestTrait; |
||||
|
||||
class TagRepositoryTest extends AbstractApiTest |
||||
{ |
||||
use ChamiloTestTrait; |
||||
|
||||
public function testCreate(): void |
||||
{ |
||||
self::bootKernel(); |
||||
|
||||
$em = $this->getManager(); |
||||
$repo = self::getContainer()->get(TagRepository::class); |
||||
$defaultCount = $repo->count([]); |
||||
|
||||
$extraField = (new ExtraField()) |
||||
->setDisplayText('test') |
||||
->setVariable('test') |
||||
->setExtraFieldType(ExtraField::USER_FIELD_TYPE) |
||||
->setFieldType(\ExtraField::FIELD_TYPE_TEXT) |
||||
; |
||||
$em->persist($extraField); |
||||
$em->flush(); |
||||
|
||||
$tag = (new Tag()) |
||||
->setTag('php') |
||||
->setCount(1) |
||||
->setField($extraField) |
||||
; |
||||
$this->assertHasNoEntityViolations($tag); |
||||
$em->persist($tag); |
||||
$em->flush(); |
||||
|
||||
$this->assertSame($defaultCount + 1, $repo->count([])); |
||||
} |
||||
} |
Loading…
Reference in new issue