File tree Expand file tree Collapse file tree 8 files changed +67
-10
lines changed Expand file tree Collapse file tree 8 files changed +67
-10
lines changed Original file line number Diff line number Diff line change 1
1
<?php
2
2
3
- namespace Tepuilabs \SimpleCrm ;
3
+ namespace Tepuilabs \SimpleCrm \ Database \ Factories ;
4
4
5
5
use Illuminate \Database \Eloquent \Factories \Factory ;
6
6
7
7
8
8
class LeadFactory extends Factory
9
9
{
10
+ protected $ model = \Tepuilabs \SimpleCrm \Models \Lead::class;
10
11
11
12
const ORGANIC_TYPE = 'Organic ' ;
12
13
const USER_SUBMITTED_TYPE = 'User Submitted ' ;
@@ -15,7 +16,6 @@ class LeadFactory extends Factory
15
16
const LEAD_STATUS = 'Lead ' ;
16
17
const CUSTOMER_STATUS = 'Customer ' ;
17
18
18
- protected $ model = \Tepuilabs \SimpleCrm \Models \Lead::class;
19
19
20
20
public function definition ()
21
21
{
Original file line number Diff line number Diff line change 1
1
<?php
2
2
3
- namespace Tepuilabs \SimpleCrm ;
3
+ namespace Tepuilabs \SimpleCrm \ Database \ Factories ;
4
4
5
5
use Illuminate \Database \Eloquent \Factories \Factory ;
6
6
Original file line number Diff line number Diff line change @@ -38,3 +38,4 @@ class CreateNotesTable extends Migration
38
38
{
39
39
Schema::dropIfExists('notes');
40
40
}
41
+ }
Original file line number Diff line number Diff line change 2
2
3
3
namespace Tepuilabs \SimpleCrm \Models ;
4
4
5
+ use Illuminate \Database \Eloquent \Factories \HasFactory ;
5
6
use Illuminate \Database \Eloquent \Model ;
6
7
use Illuminate \Database \Eloquent \Relations \HasMany ;
7
- use Illuminate \Database \Eloquent \Factories \HasFactory ;
8
8
9
9
/**
10
10
* @url https://www.hipb2b.com/blog/lead-prospect-whats-difference
11
11
*/
12
12
class Lead extends Model
13
13
{
14
-
15
14
use HasFactory;
16
15
17
16
const ORGANIC_TYPE = 'Organic ' ;
@@ -43,6 +42,11 @@ public function notes(): HasMany
43
42
return $ this ->hasMany (\Tepuilabs \SimpleCrm \Models \Note::class);
44
43
}
45
44
45
+ /**
46
+ * Undocumented function
47
+ *
48
+ * @return array
49
+ */
46
50
public static function getTypes (): array
47
51
{
48
52
return [
@@ -51,6 +55,11 @@ public static function getTypes(): array
51
55
];
52
56
}
53
57
58
+ /**
59
+ * Undocumented function
60
+ *
61
+ * @return array
62
+ */
54
63
public static function getStatuses (): array
55
64
{
56
65
return [
Original file line number Diff line number Diff line change 2
2
3
3
namespace Tepuilabs \SimpleCrm \Models ;
4
4
5
+ use Illuminate \Database \Eloquent \Factories \HasFactory ;
5
6
use Illuminate \Database \Eloquent \Model ;
6
- use Illuminate \Database \Eloquent \Relations \MorphTo ;
7
7
use Illuminate \Database \Eloquent \Relations \BelongsTo ;
8
- use Illuminate \Database \Eloquent \Factories \ HasFactory ;
8
+ use Illuminate \Database \Eloquent \Relations \ MorphTo ;
9
9
10
10
class Note extends Model
11
11
{
12
-
13
12
use HasFactory;
14
13
15
14
const LOW_PRIORITY = 'Low ' ;
Original file line number Diff line number Diff line change 1
1
<?php
2
2
namespace Tepuilabs \SimpleCrm \Tests \Models ;
3
3
4
- use Tepuilabs \SimpleCrm \Traits \HasNote ;
5
- use Illuminate \Notifications \Notifiable ;
6
4
use Illuminate \Database \Eloquent \Factories \HasFactory ;
7
5
use Illuminate \Foundation \Auth \User as Authenticatable ;
6
+ use Illuminate \Notifications \Notifiable ;
7
+ use Tepuilabs \SimpleCrm \Traits \HasNote ;
8
8
9
9
class User extends Authenticatable
10
10
{
Original file line number Diff line number Diff line change
1
+ <?php
2
+ namespace Tepuilabs \SimpleCrm \Tests \Unit ;
3
+
4
+ use Tepuilabs \SimpleCrm \Models \Lead ;
5
+ use Tepuilabs \SimpleCrm \Tests \TestCase ;
6
+
7
+ class LeadTest extends TestCase
8
+ {
9
+ /** @test */
10
+ public function test_it_can_create_lead ()
11
+ {
12
+ $ lead = Lead::factory ()->create ();
13
+
14
+ $ this ->assertInstanceOf (Lead::class, $ lead );
15
+ }
16
+
17
+ /** @test */
18
+ public function test_it_lead_status_is_prospect ()
19
+ {
20
+ $ lead = Lead::factory ()->create (['status ' => 'Prospect ' ]);
21
+
22
+ $ this ->assertEquals ('Prospect ' , $ lead ->status );
23
+ }
24
+
25
+ /** @test */
26
+ public function test_it_lead_type_is_organic ()
27
+ {
28
+ $ lead = Lead::factory ()->create (['type ' => 'Organic ' ]);
29
+
30
+ $ this ->assertEquals ('Organic ' , $ lead ->type );
31
+ }
32
+ }
Original file line number Diff line number Diff line change
1
+ <?php
2
+ namespace Tepuilabs \SimpleCrm \Tests \Unit ;
3
+
4
+ use Tepuilabs \SimpleCrm \Models \Note ;
5
+ use Tepuilabs \SimpleCrm \Tests \TestCase ;
6
+
7
+ class NoteTest extends TestCase
8
+ {
9
+ /** @test */
10
+ public function test_it_has_an_author_type ()
11
+ {
12
+ $ article = Note::factory ()->create (['author_type ' => 'Fake\User ' ]);
13
+
14
+ $ this ->assertEquals ('Fake\User ' , $ article ->author_type );
15
+ }
16
+ }
You can’t perform that action at this time.
0 commit comments