Test Setup Failed
Pull Request — master (#15)
by Stone
04:48 queued 31s
created

TrickFixtures   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 20
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A load() 0 18 2
1
<?php
2
3
namespace App\DataFixtures;
4
5
use App\Entity\Trick;
6
use Doctrine\Bundle\FixturesBundle\Fixture;
7
use Doctrine\Common\Persistence\ObjectManager;
8
use Faker\Factory;
9
10
class TrickFixtures extends Fixture
11
{
12
    public function load(ObjectManager $manager)
13
    {
14
        $faker = Factory::create();
15
        for ($i=0; $i<25; $i++){
16
            $trick = new Trick();
17
            $trick
18
                ->setName($faker->words(3, true))
1 ignored issue
show
Bug introduced by
It seems like $faker->words(3, true) can also be of type array; however, parameter $name of App\Entity\Trick::setName() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

18
                ->setName(/** @scrutinizer ignore-type */ $faker->words(3, true))
Loading history...
19
                ->setText($faker->paragraph())
20
                ->setCreatedAt($faker->dateTimeThisDecade())
21
            ;
22
23
            $manager->persist($trick);
24
        }
25
26
        // $product = new Product();
27
        // $manager->persist($product);
28
29
        $manager->flush();
30
    }
31
}
32