-
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.
Move tests requiring PHP ≥ 8.1 to their own directory
- Loading branch information
Showing
12 changed files
with
130 additions
and
174 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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
49 changes: 0 additions & 49 deletions
49
tests/Doctrine/Tests/ORM/Functional/Ticket/GH10132Test.php
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\Tests_PHP81\ORM\Functional\Ticket; | ||
|
||
use Doctrine\Common\Collections\ArrayCollection; | ||
use Doctrine\Common\Collections\Collection; | ||
use Doctrine\Tests\Models\Enums\Suit; | ||
use Doctrine\Tests\OrmFunctionalTestCase; | ||
|
||
class GH10132Test extends OrmFunctionalTestCase | ||
{ | ||
public function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
$this->createSchemaForModels( | ||
Complex::class, | ||
ComplexChild::class | ||
); | ||
} | ||
|
||
public function testQueryBackedEnumInCompositeKeyJoin(): void | ||
{ | ||
$complex = new Complex(); | ||
$complex->setType(Suit::Clubs); | ||
|
||
$complexChild = new ComplexChild(); | ||
$complexChild->setComplex($complex); | ||
|
||
$this->_em->persist($complex); | ||
$this->_em->persist($complexChild); | ||
$this->_em->flush(); | ||
$this->_em->clear(); | ||
|
||
$qb = $this->_em->createQueryBuilder(); | ||
$qb->select('s') | ||
->from(ComplexChild::class, 's') | ||
->where('s.complexType = :complexType'); | ||
|
||
$qb->setParameter('complexType', Suit::Clubs); | ||
|
||
self::assertNotNull($qb->getQuery()->getOneOrNullResult()); | ||
} | ||
} | ||
|
||
/** @Entity */ | ||
class Complex | ||
{ | ||
/** | ||
* @Id | ||
* @Column(type = "string", enumType = Suit::class) | ||
*/ | ||
protected Suit $type; | ||
|
||
/** @OneToMany(targetEntity = ComplexChild::class, mappedBy = "complex", cascade = {"persist"}) */ | ||
protected Collection $complexChildren; | ||
|
||
public function __construct() | ||
{ | ||
$this->complexChildren = new ArrayCollection(); | ||
} | ||
|
||
public function getType(): Suit | ||
{ | ||
return $this->type; | ||
} | ||
|
||
public function setType(Suit $type): void | ||
{ | ||
$this->type = $type; | ||
} | ||
|
||
public function getComplexChildren(): Collection | ||
{ | ||
return $this->complexChildren; | ||
} | ||
|
||
public function addComplexChild(ComplexChild $complexChild): void | ||
{ | ||
$this->complexChildren->add($complexChild); | ||
} | ||
} | ||
|
||
/** @Entity */ | ||
class ComplexChild | ||
{ | ||
/** | ||
* @ManyToOne(targetEntity = Complex::class, inversedBy = "complexChildren") | ||
* @JoinColumn(name = "complexType", referencedColumnName = "type", nullable = false) | ||
*/ | ||
protected Complex $complex; | ||
|
||
/** | ||
* @Id | ||
* @Column(type = "string", enumType = Suit::class) | ||
*/ | ||
protected Suit $complexType; | ||
|
||
public function setComplex(Complex $complex): void | ||
{ | ||
$complex->addComplexChild($this); | ||
$this->complexType = $complex->getType(); | ||
$this->complex = $complex; | ||
} | ||
|
||
public function getComplexType(): Suit | ||
{ | ||
return $this->complexType; | ||
} | ||
|
||
public function getComplex(): Complex | ||
{ | ||
return $this->complex; | ||
} | ||
} |
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