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

LoadPostData   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 31
ccs 0
cts 24
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A load() 0 23 1
A getOrder() 0 4 1
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
}