Skip to content

Instantly share code, notes, and snippets.

@binarious
Last active November 14, 2019 09:11
Show Gist options
  • Save binarious/51044562e232fce0a91940188287a6e8 to your computer and use it in GitHub Desktop.
Save binarious/51044562e232fce0a91940188287a6e8 to your computer and use it in GitHub Desktop.
dama error test case
<?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;
}
<?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