Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add test to prove issue with loading array to Object type column

  • Loading branch information...
commit 70b32dc17419e72ab4de3c440849b6bee8784d0b 1 parent eb87d37
@jaugustin jaugustin authored
Showing with 33 additions and 0 deletions.
  1. +33 −0 Tests/DataFixtures/Loader/YamlDataLoaderTest.php
View
33 Tests/DataFixtures/Loader/YamlDataLoaderTest.php
@@ -378,4 +378,37 @@ public function testLoadWithInheritedRelationship()
$author = $book->getAuthor();
$this->assertInstanceOf('Propel\PropelBundle\Tests\Fixtures\DataFixtures\Loader\YamlInheritedRelationshipAuthor', $author);
}
+
+ public function testLoadArrayToObjectType()
+ {
+ $schema = <<<XML
+<database name="default" package="vendor.bundles.Propel.PropelBundle.Tests.Fixtures.DataFixtures.Loader" namespace="Propel\PropelBundle\Tests\Fixtures\DataFixtures\Loader" defaultIdMethod="native">
+ <table name="table_book_with_object" phpName="YamlBookWithObject">
+ <column name="id" type="integer" primaryKey="true" />
+ <column name="name" type="varchar" size="255" />
+ <column name="options" type="object" />
+ </table>
+</database>
+XML;
+ $fixtures = <<<YAML
+Propel\PropelBundle\Tests\Fixtures\DataFixtures\Loader\YamlBookWithObject:
+ book1:
+ name: my book
+ options: {opt1: 2012, opt2: 140, inner: {subOpt: 123}}
+YAML;
+
+ $filename = $this->getTempFile($fixtures);
+
+ $builder = new \PropelQuickBuilder();
+ $builder->setSchema($schema);
+ $con = $builder->build();
+
+ $loader = new YamlDataLoader(__DIR__.'/../../Fixtures/DataFixtures/Loader');
+ $loader->load(array($filename), 'default');
+
+ $book = \Propel\PropelBundle\Tests\Fixtures\DataFixtures\Loader\YamlBookWithObjectQuery::create(null, $con)->findOne();
+
+ $this->assertInstanceOf('\Propel\PropelBundle\Tests\Fixtures\DataFixtures\Loader\YamlBookWithObject', $book);
+ $this->assertEquals(array('opt1' => 2012, 'opt2' => 140, 'inner' => array('subOpt' => 123)), $book->getOptions());
+ }
}
Please sign in to comment.
Something went wrong with that request. Please try again.