/** * @dataProvider serializationDataProvider * @param array $data */ public function testCompatibilityMode($data) { $dataSerialized = serialize($data); $platform = TestUtil::getEntityManager()->getConnection()->getDatabasePlatform(); $type = $this->getType(); $this->assertEquals($data, $type->convertToPHPValue($dataSerialized, $platform)); }
public function testSerialization() { $array = array('a' => 'b'); $encoded = base64_encode(serialize($array)); $platform = TestUtil::getEntityManager()->getConnection()->getDatabasePlatform(); Type::overrideType(Type::TARRAY, 'Oro\\DBAL\\Types\\ArrayType'); $type = Type::getType(Type::TARRAY); $actualDbValue = $type->convertToDatabaseValue($array, $platform); $this->assertEquals($encoded, $actualDbValue); $this->assertEquals($array, $type->convertToPHPValue($actualDbValue, $platform)); $this->assertEquals($array, $type->convertToPHPValue($encoded, $platform)); }
public function testSerialization() { $object = new \stdClass(); $object->a = 'test1'; $encoded = base64_encode(serialize($object)); $platform = TestUtil::getEntityManager()->getConnection()->getDatabasePlatform(); Type::overrideType(Type::OBJECT, 'Oro\\DBAL\\Types\\ObjectType'); $type = Type::getType(Type::OBJECT); $actualDbValue = $type->convertToDatabaseValue($object, $platform); $this->assertEquals($encoded, $actualDbValue); $this->assertEquals($object, $type->convertToPHPValue($actualDbValue, $platform)); $this->assertEquals($object, $type->convertToPHPValue($encoded, $platform)); }
public function testSchemaUp() { $this->entityManager = TestUtil::getEntityManager(); $schemaManager = $this->entityManager->getConnection()->getSchemaManager(); $schemaTool = new SchemaTool($this->entityManager); $tables = $schemaManager->listTableNames(); if (!empty($tables)) { $schemaTool->dropSchema($this->metadata); } $schemaTool->createSchema($this->metadata); $tables = $schemaManager->listTableNames(); $this->assertNotEmpty($tables); $this->loadFixtures(); }
protected function setUp() { $this->entityManager = TestUtil::getEntityManager(); $this->metadata = $this->entityManager->getMetadataFactory()->getAllMetadata(); }
public function testRequiresSQLCommentHint() { $platform = TestUtil::getEntityManager()->getConnection()->getDatabasePlatform(); $this->assertTrue($this->percentType->requiresSQLCommentHint($platform)); }