mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 15:33:15 +00:00
Update SQLite database reference
This commit is contained in:
48
lib/conf.d/PhraseaFixture/User/LoadOneUser.php
Normal file
48
lib/conf.d/PhraseaFixture/User/LoadOneUser.php
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Phraseanet
|
||||||
|
*
|
||||||
|
* (c) 2005-2013 Alchemy
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace PhraseaFixture\User;
|
||||||
|
|
||||||
|
use Doctrine\Common\DataFixtures\FixtureInterface;
|
||||||
|
use Doctrine\Common\DataFixtures\AbstractFixture;
|
||||||
|
use Doctrine\Common\Persistence\ObjectManager;
|
||||||
|
use Entities\User;
|
||||||
|
|
||||||
|
class LoadOneUser extends AbstractFixture implements FixtureInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @var User
|
||||||
|
*/
|
||||||
|
public $user;
|
||||||
|
|
||||||
|
public function load(ObjectManager $manager)
|
||||||
|
{
|
||||||
|
if (null === $this->user) {
|
||||||
|
throw new \Exception('Please set a user to persist');
|
||||||
|
}
|
||||||
|
|
||||||
|
$manager->persist($this->user);
|
||||||
|
$manager->flush();
|
||||||
|
|
||||||
|
$this->addReference('one-user', $this->user);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getUser()
|
||||||
|
{
|
||||||
|
return $this->user;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setUser(User $user)
|
||||||
|
{
|
||||||
|
$this->user = $user;
|
||||||
|
}
|
||||||
|
}
|
@@ -581,7 +581,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
|||||||
$this->insertFixtureInDatabase($loader);
|
$this->insertFixtureInDatabase($loader);
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->fail('Fail load one Basket : ' . $e->getMessage());
|
$this->fail('Fail load one User : ' . $e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Binary file not shown.
Reference in New Issue
Block a user