• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

miaoxing / plugin / 3766633246

pending completion
3766633246

push

github

twinh
feat(plugin): `BasePage` 增加 `pageInit` 事件

0 of 1 new or added line in 1 file covered. (0.0%)

84 existing lines in 24 files now uncovered.

902 of 2275 relevant lines covered (39.65%)

19.29 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Seeder/V20210414210514CreateUsers.php
1
<?php
2

3
namespace Miaoxing\Plugin\Seeder;
4

5
use Faker\Factory;
6
use Miaoxing\Plugin\Service\UserModel;
7

8
class V20210414210514CreateUsers extends BaseSeeder
9
{
10
    protected const SEX_MALE = 1;
11

12
    protected const SEX_FEMALE = 2;
13

14
    protected $regions = [
15
        '中国 山东 青岛',
16
        '中国 广东 广州',
17
        '中国 江苏 南通',
18
        '中国 广西 柳州',
19
        '中国 浙江 温州',
20
        '中国 上海 浦东新区',
21
        '中国 上海 闵行',
22
        '中国',
23
        '中国 广东 深圳',
24
        '格陵兰',
25
        '中国 辽宁 铁岭',
26
        '中国 河南 三门峡',
27
        '希腊',
28
    ];
29

30
    /**
31
     * {@inheritdoc}
32
     */
33
    public function run()
34
    {
35
        $faker = Factory::create('zh_CN');
×
36

37
        foreach (range(1, 30) as $i) {
×
38
            $regions = explode(' ', $faker->randomElement($this->regions));
×
39

40
            $sex = $faker->randomElement([static::SEX_MALE, static::SEX_FEMALE]);
×
41

42
            $firstName = static::SEX_MALE === $sex ? $faker->firstNameMale : $faker->firstNameFemale;
×
43

44
            /** @var \DateTime|null $mobileVerifiedAt */
45
            $mobileVerifiedAt = $faker->optional()->dateTimeThisYear();
×
46
            if ($mobileVerifiedAt) {
×
47
                $mobileVerifiedAt = $mobileVerifiedAt->format('Y-m-d H:i:s');
×
48
            }
49

50
            UserModel::saveAttributes([
×
51
                'name' => $faker->lastName . $firstName,
×
52
                'username' => $faker->userName,
×
53
                'email' => $faker->email,
×
54
                'mobile' => $faker->phoneNumber,
×
UNCOV
55
                'mobileVerifiedAt' => $mobileVerifiedAt,
×
UNCOV
56
                'sex' => $sex,
×
57
                'country' => $regions[0],
×
58
                'province' => $regions[1] ?? '',
×
59
                'city' => $regions[2] ?? '',
×
60
                'avatar' => $faker->imageUrl(480),
×
UNCOV
61
            ]);
×
62
        }
63
    }
64
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc