File tree Expand file tree Collapse file tree 3 files changed +44
-4
lines changed Expand file tree Collapse file tree 3 files changed +44
-4
lines changed Original file line number Diff line number Diff line change 5
5
use Illuminate \Database \Eloquent \Factories \Factory ;
6
6
7
7
8
- class LeadFactory extends Factory
8
+ class NoteFactory extends Factory
9
9
{
10
10
protected $ model = \Tepuilabs \SimpleCrm \Models \Note::class;
11
11
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Tepuilabs \SimpleCrm \Database \Factories ;
4
+
5
+ use Illuminate \Support \Str ;
6
+ use Illuminate \Database \Eloquent \Factories \Factory ;
7
+
8
+ class UserFactory extends Factory
9
+ {
10
+ /**
11
+ * The name of the factory's corresponding model.
12
+ *
13
+ * @var string
14
+ */
15
+ protected $ model = \Tepuilabs \SimpleCrm \Tests \Models \User::class;
16
+
17
+ /**
18
+ * Define the model's default state.
19
+ *
20
+ * @return array
21
+ */
22
+ public function definition ()
23
+ {
24
+ return [
25
+ 'name ' => $ this ->faker ->name ,
26
+ 'email ' => $ this ->faker ->unique ()->safeEmail ,
27
+ 'email_verified_at ' => now (),
28
+ 'password ' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi ' , // password
29
+ 'remember_token ' => Str::random (10 ),
30
+ ];
31
+ }
32
+ }
Original file line number Diff line number Diff line change 7
7
class NoteTest extends TestCase
8
8
{
9
9
/** @test */
10
- public function test_it_has_an_author_type ()
10
+ public function test_it_user_can_create_a_note ()
11
11
{
12
- $ article = Note::factory ()->create (['author_type ' => 'Fake\User ' ]);
12
+ $ user = \Tepuilabs \SimpleCrm \Tests \Models \User::factory ()->create ();
13
+ $ lead = \Tepuilabs \SimpleCrm \Models \Lead::factory ()->create ();
13
14
14
- $ this ->assertEquals ('Fake\User ' , $ article ->author_type );
15
+ $ note = $ user ->notes ()->create ([
16
+ 'priority ' => 'Low ' ,
17
+ 'title ' => 'Some title ' ,
18
+ 'body ' => 'Some body ' ,
19
+ 'lead_id ' => $ lead ->id ,
20
+ ]);
21
+
22
+ $ this ->assertInstanceOf (Note::class, $ note );
15
23
}
16
24
}
You can’t perform that action at this time.
0 commit comments