Skip to content

Commit c41e16a

Browse files
committed
closes #1739
1 parent 2044516 commit c41e16a

File tree

2 files changed

+55
-1
lines changed

2 files changed

+55
-1
lines changed

tests/Gedmo/Sluggable/Fixture/MappedSuperclass/Vehicle.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class Vehicle
1616
private $title;
1717

1818
/**
19-
* @Gedmo\Slug(fields={"title"})
19+
* @Gedmo\Slug(fields={"title"}, updatable=false)
2020
* @ORM\Column(length=128, unique=true)
2121
*/
2222
private $slug;

tests/Gedmo/Sluggable/MappedSuperclassTest.php

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,60 @@ public function shouldntGenerateNotice()
4141
$this->em->flush();
4242
}
4343

44+
/**
45+
* @test
46+
*/
47+
public function shouldntMaintainUniqueSlug()
48+
{
49+
$evm = new EventManager();
50+
$evm->addEventSubscriber(new SluggableListener());
51+
$this->getMockSqliteEntityManager($evm);
52+
53+
$a = new Car();
54+
$a->setTitle('di 1');
55+
$a->setDescription("a");
56+
$this->em->persist($a);
57+
$this->em->flush();
58+
59+
$b = new Car();
60+
$b->setTitle('di');
61+
$b->setDescription("b");
62+
$this->em->persist($b);
63+
$this->em->flush();
64+
65+
$c = new Car();
66+
$c->setTitle('di');
67+
$c->setDescription("c");
68+
$this->em->persist($c);
69+
$this->em->flush();
70+
}
71+
72+
/**
73+
* @test
74+
*/
75+
public function shouldntMaintainUniqueSlugInSingleTransaction()
76+
{
77+
$evm = new EventManager();
78+
$evm->addEventSubscriber(new SluggableListener());
79+
$this->getMockSqliteEntityManager($evm);
80+
81+
$a = new Car();
82+
$a->setTitle('di 1');
83+
$a->setDescription("a");
84+
$this->em->persist($a);
85+
86+
$b = new Car();
87+
$b->setTitle('di');
88+
$b->setDescription("b");
89+
$this->em->persist($b);
90+
91+
$c = new Car();
92+
$c->setTitle('di');
93+
$c->setDescription("c");
94+
$this->em->persist($c);
95+
$this->em->flush();
96+
}
97+
4498
protected function getUsedEntityFixtures()
4599
{
46100
return array(

0 commit comments

Comments
 (0)