ea6a359272
* Upd: Add Symfony 4 Compatibility #SymfonyConHackday2017 * Upd: Configure visibility of services for SF4 * Updated composer to allow Symfony 4.0 * Updated composer to allow Symfony 4.0 * PropelBundle for Symfony 4 * Upd: Travis configuration * Upd: PHP 5 not supported anymore by PHPUnit * Upd: Removing old SF version + PHPUnit correction * * Removed param that was removed in symfony/yaml afb873f * Updated format of object dumping as deprecated tags using colon symfony/yaml 38d3087 * * Added commands to console.xml as symfony no longer auto registers bundle commands * Updated two services to public * * Removed deprecated getMock calls for new createMock calls. * * Add stub for additional abstract method * * Updated schema locator test * reverted unnecessary changes to abstract command and schemal locator * Added fixtures for schema testing. * * Updated schema locator test * reverted unnecessary changes to abstract command and schemal locator * Added fixtures for schema testing. * * Removed unnecessary default for services * Updated readme to reflect symfony version support
62 lines
1.9 KiB
PHP
62 lines
1.9 KiB
PHP
<?php
|
|
|
|
/**
|
|
* This file is part of the PropelBundle package.
|
|
* For the full copyright and license information, please view the LICENSE
|
|
* file that was distributed with this source code.
|
|
*
|
|
* @license MIT License
|
|
*/
|
|
|
|
namespace Propel\Bundle\PropelBundle\Tests\DataFixtures\Dumper;
|
|
|
|
use Propel\Runtime\Propel;
|
|
use Propel\Bundle\PropelBundle\Tests\DataFixtures\TestCase;
|
|
use Propel\Bundle\PropelBundle\DataFixtures\Dumper\YamlDataDumper;
|
|
|
|
/**
|
|
* @author William Durand <william.durand1@gmail.com>
|
|
* @author Toni Uebernickel <tuebernickel@gmail.com>
|
|
*/
|
|
class YamlDataDumperTest extends TestCase
|
|
{
|
|
public function testYamlDump()
|
|
{
|
|
$author = new \Propel\Bundle\PropelBundle\Tests\Fixtures\DataFixtures\Loader\CoolBookAuthor();
|
|
$author->setName('A famous one')->save($this->con);
|
|
|
|
$complementary = new \stdClass();
|
|
$complementary->first_word_date = '2012-01-01';
|
|
|
|
$book = new \Propel\Bundle\PropelBundle\Tests\Fixtures\DataFixtures\Loader\CoolBook();
|
|
$book
|
|
->setName('An important one')
|
|
->setAuthorId(1)
|
|
->setComplementaryInfos($complementary)
|
|
->save($this->con)
|
|
;
|
|
|
|
$filename = $this->getTempFile();
|
|
|
|
$loader = new YamlDataDumper(__DIR__.'/../../Fixtures/DataFixtures/Loader', array());
|
|
$loader->dump($filename);
|
|
|
|
$expected = <<<YAML
|
|
\Propel\Bundle\PropelBundle\Tests\Fixtures\DataFixtures\Loader\CoolBookAuthor:
|
|
CoolBookAuthor_1:
|
|
id: '1'
|
|
name: 'A famous one'
|
|
\Propel\Bundle\PropelBundle\Tests\Fixtures\DataFixtures\Loader\CoolBook:
|
|
CoolBook_1:
|
|
id: '1'
|
|
name: 'An important one'
|
|
author_id: CoolBookAuthor_1
|
|
complementary_infos: !php/object 'O:8:"stdClass":1:{s:15:"first_word_date";s:10:"2012-01-01";}'
|
|
|
|
YAML;
|
|
$result = file_get_contents($filename);
|
|
|
|
$this->assertEquals($expected, $result);
|
|
}
|
|
}
|