-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
790b85c
commit 2d9befb
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
namespace Tests\Terms; | ||
|
||
use Illuminate\Foundation\Testing\RefreshDatabase; | ||
use PHPUnit\Framework\Attributes\Test; | ||
use Statamic\Eloquent\Taxonomies\Taxonomy; | ||
use Statamic\Eloquent\Taxonomies\TermModel; | ||
use Statamic\Facades\Term as TermFacade; | ||
use Tests\TestCase; | ||
|
||
class TermTest extends TestCase | ||
{ | ||
use RefreshDatabase; | ||
|
||
#[Test] | ||
public function it_doesnt_create_a_new_model_when_slug_is_changed() | ||
{ | ||
Taxonomy::make('test')->title('test')->save(); | ||
|
||
$term = tap(TermFacade::make('test-term')->taxonomy('test')->data([]))->save(); | ||
|
||
$this->assertCount(1, TermModel::all()); | ||
$this->assertSame('test-term', TermModel::first()->slug); | ||
|
||
$term->slug('new-slug'); | ||
$term->save(); | ||
|
||
$this->assertCount(1, TermModel::all()); | ||
$this->assertSame('new-slug', TermModel::first()->slug); | ||
} | ||
} |