fixture for a date choice

This commit is contained in:
Baptiste Lemoine 2019-11-12 12:00:06 +01:00
parent f93d235645
commit ffb8b14b53
1 changed files with 13 additions and 1 deletions

View File

@ -5,6 +5,7 @@ namespace App\DataFixtures;
use App\Entity\Choice;
use App\Entity\Owner;
use App\Entity\Poll;
use App\Entity\StackOfVotes;
use App\Entity\Vote;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\Persistence\ObjectManager;
@ -69,12 +70,23 @@ class AppPollFixtures extends Fixture {
$manager->persist( $poll );
// voting test with 2 people
$stack1 = new StackOfVotes();
$stack1->setOwner( $voter )
->addVote( $poll->getChoices()[ 0 ] );
$stack2 = new StackOfVotes();
$stack1->setOwner( $owner )->addVote( $poll->getChoices()[ 1 ] );
$voter->addStackOfVote( $stack1 );
$owner->addStackOfVote( $stack2 );
$poll = new Poll();
$poll->setTitle( 'accès restreint sondage de texte' );
$poll->setKind( 'text' );
$poll->setPassword( md5( 'mot_de_passe_super' ) );
$poll->setModificationPolicy( 'everybody' );
$poll->setDescription( 'description du sondage' );
$poll->setDescription( 'description du sondage a accès restreint. le mot de passe est mot_de_passe_super' );
$poll->setAdminKey( uniqid() );
$poll->setCustomUrl( 'boudoum_podom_podom' );
$poll->setCreationDate( new \DateTime() );