1
0
mirror of synced 2024-12-14 07:06:04 +03:00

missing files

This commit is contained in:
Fabio B. Silva 2012-06-01 14:57:01 -03:00
parent db53b8651c
commit 505bdb9c03
2 changed files with 122 additions and 0 deletions

View File

@ -0,0 +1,32 @@
<?php
namespace Doctrine\Tests\Models\DDC1719;
/**
* @Entity
* @Table(name="`ddc-1719-entity`")
*/
class DDC1719Entity
{
/**
* @Id
* @Column(type="integer", name="`entity-id`")
* @GeneratedValue(strategy="AUTO")
*/
public $id;
/**
* @Column(type="string", name="`entity-value`")
*/
public $value;
/**
* @param string $value
*/
public function __construct($value)
{
$this->value = $value;
}
}

View File

@ -0,0 +1,90 @@
<?php
namespace Doctrine\Tests\ORM\Functional\Ticket;
use Doctrine\Tests\Models\DDC1719\DDC1719Entity;
require_once __DIR__ . '/../../../TestInit.php';
/**
* @group DDC-1719
*/
class DDC1719Test extends \Doctrine\Tests\OrmFunctionalTestCase
{
const CLASS_NAME = '\Doctrine\Tests\Models\DDC1719\DDC1719Entity';
protected function setUp()
{
$this->markTestIncomplete();
parent::setUp();
try {
$this->_schemaTool->createSchema(array(
$this->_em->getClassMetadata(self::CLASS_NAME),
));
} catch(\Exception $e) {
}
}
public function testCreateRetreaveUpdateDelete()
{
$e1 = new DDC1719Entity('Bar 1');
$e2 = new DDC1719Entity('Foo 1');
// Create
$this->_em->persist($e1);
$this->_em->persist($e2);
$this->_em->flush();
$this->_em->clear();
$e1Id = $e1->id;
$e2Id = $e2->id;
// Retreave
$e1 = $this->_em->find(self::CLASS_NAME, $e1Id);
$e2 = $this->_em->find(self::CLASS_NAME, $e2Id);
$this->assertInstanceOf(self::CLASS_NAME, $e1);
$this->assertInstanceOf(self::CLASS_NAME, $e2);
$this->assertEquals($e1Id, $e1->id);
$this->assertEquals($e2Id, $e2->id);
$this->assertEquals('Bar 1', $e1->value);
$this->assertEquals('Foo 1', $e2->value);
$e1->value = 'Bar 2';
$e2->value = 'Foo 2';
// Update
$this->_em->persist($e1);
$this->_em->persist($e2);
$this->_em->flush();
$this->assertEquals('Bar 2', $e1->value);
$this->assertEquals('Foo 2', $e2->value);
$this->assertInstanceOf(self::CLASS_NAME, $e1);
$this->assertInstanceOf(self::CLASS_NAME, $e2);
$this->assertEquals($e1Id, $e1->id);
$this->assertEquals($e2Id, $e2->id);
$this->assertEquals('Bar 2', $e1->value);
$this->assertEquals('Foo 2', $e2->value);
// Delete
$this->_em->remove($e1);
$this->_em->remove($e2);
$this->_em->flush();
$e1 = $this->_em->find(self::CLASS_NAME, $e1Id);
$e2 = $this->_em->find(self::CLASS_NAME, $e2Id);
$this->assertNull($e1);
$this->assertNull($e2);
}
}