/** * @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)); }
/** * @return array */ public function functionsDataProvider() { $platform = TestUtil::getPlatformName(); $data = array(); $files = new \FilesystemIterator(__DIR__ . '/fixtures/' . $platform, \FilesystemIterator::SKIP_DOTS); foreach ($files as $file) { $data = array_merge($data, Yaml::parse($file)); } return $data; }
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(); }
/** * @return array */ public function functionsDataProvider() { $platform = TestUtil::getPlatformName(); $data = array(); $files = new \FilesystemIterator(__DIR__ . '/fixtures/' . $platform, \FilesystemIterator::SKIP_DOTS); foreach ($files as $file) { $fileData = Yaml::parse($file); if (!is_array($fileData)) { throw new \RuntimeException(sprintf('Could not parse file %s', $file)); } $data = array_merge($data, $fileData); } return $data; }
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)); }
/** * @return array */ public function functionsDataProvider() { $platform = TestUtil::getPlatformName(); $data = Yaml::parse(__DIR__ . '/fixtures/functions.' . strtolower($platform) . '.yml'); return $data; }