@@ -49,17 +49,14 @@ public function load(ObjectManager $manager)
49
49
$ post ->setSummary ($ this ->getRandomPostSummary ());
50
50
$ post ->setSlug ($ this ->container ->get ('slugger ' )->slugify ($ post ->getTitle ()));
51
51
$ 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
- }
61
52
$ post ->setPublishedAt (new \DateTime ('now - ' .$ i .'days ' ));
62
53
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
+
63
60
// for aesthetic reasons, the first blog post always has 2 tags
64
61
foreach ($ this ->getRandomTags ($ i > 0 ? mt_rand (0 , 3 ) : 2 ) as $ tag ) {
65
62
$ post ->addTag ($ tag );
@@ -100,7 +97,7 @@ public function getDependencies()
100
97
101
98
private function getRandomUser ()
102
99
{
103
- $ admins = ['jane-admin ' , 'tom-admin ' , ' bob-admin ' ];
100
+ $ admins = ['jane-admin ' , 'tom-admin ' ];
104
101
$ index = array_rand ($ admins );
105
102
106
103
return $ this ->getReference ($ admins [$ index ]);
0 commit comments