Last active
November 14, 2019 09:11
-
-
Save binarious/51044562e232fce0a91940188287a6e8 to your computer and use it in GitHub Desktop.
dama error test case
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Entity; | |
use Doctrine\ORM\Mapping\Id; | |
use Doctrine\ORM\Mapping\Column; | |
use Doctrine\ORM\Mapping\Entity; | |
use Doctrine\ORM\Mapping\GeneratedValue; | |
/** @Entity */ | |
class Name | |
{ | |
public function __construct(string $name) | |
{ | |
$this->name = $name; | |
} | |
/** | |
* @Id | |
* @Column(type="integer") | |
* @GeneratedValue(strategy="AUTO") | |
* @var int|null | |
*/ | |
protected $id; | |
/** | |
* @Column(type="string", length=255) | |
* @var string | |
*/ | |
protected $name; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Tests; | |
use App\Entity\Name; | |
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; | |
class Test extends WebTestCase | |
{ | |
private $em; | |
protected function setUp(): void | |
{ | |
static::$kernel = static::createKernel(); | |
static::$kernel->boot(); | |
$this->em = static::$kernel->getContainer() | |
->get('doctrine') | |
->getManager() | |
; | |
} | |
public function testError(): void | |
{ | |
$client = static::createClient(); | |
$name = new Name('myname'); | |
$this->em->persist($name); | |
$this->em->flush(); | |
$this->assertTrue(true); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment