Passed
Pull Request — master (#153)
by Kevin
03:19
created

PostFactory::getDefaults()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 5
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Zenstruck\Foundry\Tests\Fixtures\Factories\ODM;
4
5
use Zenstruck\Foundry\ModelFactory;
6
use Zenstruck\Foundry\Tests\Fixtures\Document\Post;
7
8
class PostFactory extends ModelFactory
9
{
10
    public function published(): self
11
    {
12
        return $this->addState(function() {
13
            return ['published_at' => self::faker()->dateTime()];
14
        });
15
    }
16
17
    protected static function getClass(): string
18
    {
19
        return Post::class;
20
    }
21
22
    protected function getDefaults(): array
23
    {
24
        return [
25
            'title' => self::faker()->sentence(),
26
            'body' => self::faker()->sentence(),
27
        ];
28
    }
29
}
30