@@ -49,17 +49,14 @@ public function load(ObjectManager $manager)
4949 $ post ->setSummary ($ this ->getRandomPostSummary ());
5050 $ post ->setSlug ($ this ->container ->get ('slugger ' )->slugify ($ post ->getTitle ()));
5151 $ post ->setContent ($ this ->getPostContent ());
52- // This ensures that the first post is written by Jane Doe
53- if (0 === $ i ) {
54- // "References" are the way to share objects between fixtures defined
55- // in different files. This reference has been added in the UserFixtures
56- // file and it contains an instance of the User entity.
57- $ post ->setAuthor ($ this ->getReference ('jane-admin ' ));
58- } else {
59- $ post ->setAuthor ($ this ->getRandomUser ());
60- }
6152 $ post ->setPublishedAt (new \DateTime ('now - ' .$ i .'days ' ));
6253
54+ // Ensure that the first post is written by Jane Doe to simplify tests
55+ // "References" are the way to share objects between fixtures defined
56+ // in different files. This reference has been added in the UserFixtures
57+ // file and it contains an instance of the User entity.
58+ $ post ->setAuthor (0 === $ i ? $ this ->getReference ('jane-admin ' ) : $ this ->getRandomUser ());
59+
6360 // for aesthetic reasons, the first blog post always has 2 tags
6461 foreach ($ this ->getRandomTags ($ i > 0 ? mt_rand (0 , 3 ) : 2 ) as $ tag ) {
6562 $ post ->addTag ($ tag );
@@ -100,7 +97,7 @@ public function getDependencies()
10097
10198 private function getRandomUser ()
10299 {
103- $ admins = ['jane-admin ' , 'tom-admin ' , ' bob-admin ' ];
100+ $ admins = ['jane-admin ' , 'tom-admin ' ];
104101 $ index = array_rand ($ admins );
105102
106103 return $ this ->getReference ($ admins [$ index ]);
0 commit comments