public function setUp()
{
$kernel = static::createKernel();
$kernel->boot();
if ($kernel->getContainer()->getParameter('database_driver') == 'pdo_sqlite') {
$this->markTestSkipped("The SQLite does not support joins.");
}
$this->em = $kernel->getContainer()->get('knp_bundles.entity_manager');
$fileLocator = new FileLocator(__DIR__ . '/fixtures/');
$path = $fileLocator->locate('trending-bundles.yml');
$data = Yaml::parse($path);
$developer = new Developer();
$developer->setName('someName');
$developer->setScore(0);
$this->em->persist($developer);
foreach ($data['bundles'] as $bundleName => $bundleData) {
$bundle = new Bundle('vendor/' . $bundleName);
$bundle->setDescription('some description');
$bundle->setScore(100);
$bundle->setOwner($developer);
foreach ($bundleData['scores'] as $scoreData) {
$bundle->setDescription(md5(time() . serialize($scoreData)));
$score = new Score();
$score->setDate(new \DateTime($scoreData['date']));
$score->setBundle($bundle);
$score->setValue($scoreData['value']);
$this->em->persist($score);
}
$this->em->persist($bundle);
}
$this->em->flush();
}