-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7405 from Majkl578/2.x-into-master
Cherry-pick stuff from 2.x into master
- Loading branch information
Showing
19 changed files
with
587 additions
and
20 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
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
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
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
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
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
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
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
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
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
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
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
167 changes: 167 additions & 0 deletions
167
tests/Doctrine/Tests/ORM/Functional/Ticket/GH7259Test.php
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,167 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\Tests\ORM\Functional\Ticket; | ||
|
||
use Doctrine\ORM\Annotation as ORM; | ||
use Doctrine\Tests\OrmFunctionalTestCase; | ||
|
||
final class GH7259Test extends OrmFunctionalTestCase | ||
{ | ||
protected function setUp() : void | ||
{ | ||
parent::setUp(); | ||
|
||
$this->setUpEntitySchema([GH7259Space::class, GH7259File::class, GH7259FileVersion::class, GH7259Feed::class]); | ||
} | ||
|
||
/** | ||
* @group 7259 | ||
*/ | ||
public function testPersistFileBeforeVersion() : void | ||
{ | ||
$space = new GH7259Space(); | ||
|
||
$this->em->persist($space); | ||
$this->em->flush(); | ||
|
||
$feed = new GH7259Feed(); | ||
$feed->space = $space; | ||
|
||
$file = new GH7259File(); | ||
$file->space = $space; | ||
$fileVersion = new GH7259FileVersion(); | ||
$fileVersion->file = $file; | ||
|
||
$this->em->persist($file); | ||
$this->em->persist($fileVersion); | ||
$this->em->persist($feed); | ||
|
||
$this->em->flush(); | ||
|
||
self::assertNotNull($fileVersion->id); | ||
} | ||
|
||
/** | ||
* @group 7259 | ||
*/ | ||
public function testPersistFileAfterVersion() : void | ||
{ | ||
$space = new GH7259Space(); | ||
|
||
$this->em->persist($space); | ||
$this->em->flush(); | ||
$this->em->clear(); | ||
|
||
$space = $this->em->find(GH7259Space::class, $space->id); | ||
|
||
$feed = new GH7259Feed(); | ||
$feed->space = $space; | ||
|
||
$file = new GH7259File(); | ||
$file->space = $space; | ||
$fileVersion = new GH7259FileVersion(); | ||
$fileVersion->file = $file; | ||
|
||
$this->em->persist($fileVersion); | ||
$this->em->persist($file); | ||
$this->em->persist($feed); | ||
|
||
$this->em->flush(); | ||
|
||
self::assertNotNull($fileVersion->id); | ||
} | ||
} | ||
|
||
/** | ||
* @ORM\Entity() | ||
*/ | ||
class GH7259File | ||
{ | ||
/** | ||
* @ORM\Id | ||
* @ORM\GeneratedValue | ||
* @ORM\Column(type="integer") | ||
* | ||
* @var int | ||
*/ | ||
public $id; | ||
|
||
/** | ||
* @ORM\ManyToOne(targetEntity=GH7259Space::class) | ||
* @ORM\JoinColumn(nullable=false) | ||
* | ||
* @var GH7259Space|null | ||
*/ | ||
public $space; | ||
} | ||
|
||
/** | ||
* @ORM\Entity() | ||
*/ | ||
class GH7259FileVersion | ||
{ | ||
/** | ||
* @ORM\Id | ||
* @ORM\GeneratedValue | ||
* @ORM\Column(type="integer") | ||
* | ||
* @var int | ||
*/ | ||
public $id; | ||
|
||
/** | ||
* @ORM\ManyToOne(targetEntity=GH7259File::class) | ||
* @ORM\JoinColumn(nullable=false) | ||
* | ||
* @var GH7259File|null | ||
*/ | ||
public $file; | ||
} | ||
|
||
/** | ||
* @ORM\Entity() | ||
*/ | ||
class GH7259Space | ||
{ | ||
/** | ||
* @ORM\Id | ||
* @ORM\GeneratedValue | ||
* @ORM\Column(type="integer") | ||
* | ||
* @var int | ||
*/ | ||
public $id; | ||
|
||
/** | ||
* @ORM\ManyToOne(targetEntity=GH7259File::class) | ||
* @ORM\JoinColumn(nullable=true) | ||
* | ||
* @var GH7259File|null | ||
*/ | ||
public $ruleFile; | ||
} | ||
|
||
/** | ||
* @ORM\Entity() | ||
*/ | ||
class GH7259Feed | ||
{ | ||
/** | ||
* @ORM\Id | ||
* @ORM\GeneratedValue | ||
* @ORM\Column(type="integer") | ||
* | ||
* @var int | ||
*/ | ||
public $id; | ||
|
||
/** | ||
* @ORM\ManyToOne(targetEntity=GH7259Space::class) | ||
* @ORM\JoinColumn(nullable=false) | ||
* | ||
* @var GH7259Space|null | ||
*/ | ||
public $space; | ||
} |
Oops, something went wrong.