Skip to content

Commit

Permalink
Add test for overwrite and no title present.
Browse files Browse the repository at this point in the history
  • Loading branch information
dereuromark committed Feb 28, 2024
1 parent 67063a9 commit 48bfcb9
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/TestCase/Model/Behavior/SluggedBehaviorTest.php
Expand Up @@ -217,6 +217,15 @@ public function testNeedsSlugUpdate() {

$result = $this->articles->save($entity);
$this->assertEquals('Some-really-other-title', $result->get('slug'));

$this->articles->behaviors()->Slugged->setConfig(['overwrite' => true]);
// Without title present it should not modify the slug
$entity = $this->articles->patchEntity($entity, ['foo' => 'bar']);
$result = $this->articles->needsSlugUpdate($entity);
$this->assertFalse($result);

$result = $this->articles->save($entity);
$this->assertEquals('Some-really-other-title', $result->get('slug'));
}

/**
Expand Down

0 comments on commit 48bfcb9

Please sign in to comment.