Skip to content

Commit 042870e

Browse files
author
angel cruz
committed
Fix all errors, all errors on the WORLD!!!!
1 parent 0b53e0d commit 042870e

File tree

8 files changed

+67
-10
lines changed

8 files changed

+67
-10
lines changed

database/factories/LeadFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
<?php
22

3-
namespace Tepuilabs\SimpleCrm;
3+
namespace Tepuilabs\SimpleCrm\Database\Factories;
44

55
use Illuminate\Database\Eloquent\Factories\Factory;
66

77

88
class LeadFactory extends Factory
99
{
10+
protected $model = \Tepuilabs\SimpleCrm\Models\Lead::class;
1011

1112
const ORGANIC_TYPE = 'Organic';
1213
const USER_SUBMITTED_TYPE = 'User Submitted';
@@ -15,7 +16,6 @@ class LeadFactory extends Factory
1516
const LEAD_STATUS = 'Lead';
1617
const CUSTOMER_STATUS = 'Customer';
1718

18-
protected $model = \Tepuilabs\SimpleCrm\Models\Lead::class;
1919

2020
public function definition()
2121
{

database/factories/NoteFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Tepuilabs\SimpleCrm;
3+
namespace Tepuilabs\SimpleCrm\Database\Factories;
44

55
use Illuminate\Database\Eloquent\Factories\Factory;
66

database/migrations/create_notes_table.php.stub

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,4 @@ class CreateNotesTable extends Migration
3838
{
3939
Schema::dropIfExists('notes');
4040
}
41+
}

src/Models/Lead.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,15 @@
22

33
namespace Tepuilabs\SimpleCrm\Models;
44

5+
use Illuminate\Database\Eloquent\Factories\HasFactory;
56
use Illuminate\Database\Eloquent\Model;
67
use Illuminate\Database\Eloquent\Relations\HasMany;
7-
use Illuminate\Database\Eloquent\Factories\HasFactory;
88

99
/**
1010
* @url https://www.hipb2b.com/blog/lead-prospect-whats-difference
1111
*/
1212
class Lead extends Model
1313
{
14-
1514
use HasFactory;
1615

1716
const ORGANIC_TYPE = 'Organic';
@@ -43,6 +42,11 @@ public function notes(): HasMany
4342
return $this->hasMany(\Tepuilabs\SimpleCrm\Models\Note::class);
4443
}
4544

45+
/**
46+
* Undocumented function
47+
*
48+
* @return array
49+
*/
4650
public static function getTypes(): array
4751
{
4852
return [
@@ -51,6 +55,11 @@ public static function getTypes(): array
5155
];
5256
}
5357

58+
/**
59+
* Undocumented function
60+
*
61+
* @return array
62+
*/
5463
public static function getStatuses(): array
5564
{
5665
return [

src/Models/Note.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22

33
namespace Tepuilabs\SimpleCrm\Models;
44

5+
use Illuminate\Database\Eloquent\Factories\HasFactory;
56
use Illuminate\Database\Eloquent\Model;
6-
use Illuminate\Database\Eloquent\Relations\MorphTo;
77
use Illuminate\Database\Eloquent\Relations\BelongsTo;
8-
use Illuminate\Database\Eloquent\Factories\HasFactory;
8+
use Illuminate\Database\Eloquent\Relations\MorphTo;
99

1010
class Note extends Model
1111
{
12-
1312
use HasFactory;
1413

1514
const LOW_PRIORITY = 'Low';

tests/Models/User.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?php
22
namespace Tepuilabs\SimpleCrm\Tests\Models;
33

4-
use Tepuilabs\SimpleCrm\Traits\HasNote;
5-
use Illuminate\Notifications\Notifiable;
64
use Illuminate\Database\Eloquent\Factories\HasFactory;
75
use Illuminate\Foundation\Auth\User as Authenticatable;
6+
use Illuminate\Notifications\Notifiable;
7+
use Tepuilabs\SimpleCrm\Traits\HasNote;
88

99
class User extends Authenticatable
1010
{

tests/Unit/LeadTest.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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+
}

tests/Unit/NoteTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
}

0 commit comments

Comments
 (0)