Test Setup Failed
Push — master ( 1d88cc...3d481f )
by Alexey
02:54
created

LoadPostData::getOrder()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 3
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Skobkin\Bundle\PointToolsBundle\DataFixtures\ORM;
4
5
use Doctrine\Common\DataFixtures\AbstractFixture;
6
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
7
use Doctrine\Common\Persistence\ObjectManager;
8
use Skobkin\Bundle\PointToolsBundle\Entity\Blogs\Post;
9
use Skobkin\Bundle\PointToolsBundle\Entity\User;
10
11
class LoadPostData extends AbstractFixture implements OrderedFixtureInterface
12
{
13
    public function load(ObjectManager $om)
14
    {
15
        /** @var User $testUser */
16
        $testUser = $this->getReference('test_user_99999');
17
18
        $longPost = (new Post('longpost', $testUser, new \DateTime(), Post::TYPE_POST))
19
            ->setText('Test post with many comments')
20
            ->setPrivate(false)
21
            ->setDeleted(false)
22
        ;
23
24
        $shortPost = (new Post('shortpost', $testUser, new \DateTime(), Post::TYPE_POST))
25
            ->setText('Test short post')
26
            ->setPrivate(false)
27
            ->setDeleted(false)
28
        ;
29
30
        $om->persist($longPost);
31
        $om->persist($shortPost);
32
        $om->flush();
33
34
        $this->addReference('test_post_longpost', $longPost);
35
    }
36
37
    public function getOrder(): int
38
    {
39
        return 2;
40
    }
41
}