Skip to content

Commit

Permalink
added support for 2.8.3 (#15)
Browse files Browse the repository at this point in the history
* added support for 2.8.3
* Remove dependency on doctrine test files
  • Loading branch information
sspat authored Jan 17, 2022
1 parent b2f0e4c commit 6f1a05c
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 9 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ If you choose this path, you can install this package in the following steps:
```
Then depending on the version of doctrine/orm you want to use:

- run `composer require sspat/doctrine-nullable-embeddables:v2.8.3 doctrine/orm`
- run `composer require sspat/doctrine-nullable-embeddables:v2.8.2 doctrine/orm`
- run `composer require sspat/doctrine-nullable-embeddables:v2.8.1 doctrine/orm`
- run `composer require sspat/doctrine-nullable-embeddables:v2.8.0 doctrine/orm`
Expand Down
13 changes: 8 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"require": {
"php": "^7.4|^8.0",
"cweagans/composer-patches": "^1.6|^1.7",
"doctrine/orm": "2.8.2"
"doctrine/orm": "2.8.3"
},
"require-dev": {
"phpunit/phpunit": "^9.5"
Expand All @@ -31,16 +31,19 @@
"extra": {
"patches": {
"doctrine/orm": {
"Allow nullable embeddables": "https://raw.githubusercontent.com/sspat/doctrine-nullable-embeddables/v2.8.2/patch/nullable_embeddables.patch"
"Allow nullable embeddables": "https://raw.githubusercontent.com/sspat/doctrine-nullable-embeddables/v2.8.3/patch/nullable_embeddables.patch"
}
}
},
"config": {
"preferred-install": {
"*": "dist",
"doctrine/orm": "source"
"*": "dist"
},
"sort-packages": true
"sort-packages": true,
"allow-plugins": {
"composer/package-versions-deprecated": true,
"cweagans/composer-patches": true
}
},
"scripts": {
"test": "phpunit"
Expand Down
32 changes: 32 additions & 0 deletions tests/Models/Generic/BooleanModel.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

declare(strict_types=1);

namespace DoctrineNullableEmbeddables\Tests\Models\Generic;

use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\GeneratedValue;
use Doctrine\ORM\Mapping\Id;
use Doctrine\ORM\Mapping\Table;

/**
* @Entity
* @Table(name="boolean_model")
*/
class BooleanModel
{
/**
* @var int
* @Id
* @Column(type="integer")
* @GeneratedValue(strategy="AUTO")
*/
public $id;

/**
* @var bool
* @Column(type="boolean")
*/
public $booleanField;
}
14 changes: 14 additions & 0 deletions tests/Models/Reflection/AbstractEmbeddable.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

declare(strict_types=1);

namespace DoctrineNullableEmbeddables\Tests\Models\Reflection;

/**
* A test asset used to check that embeddables support properties defined in abstract classes
*/
abstract class AbstractEmbeddable
{
/** @var string */
private $propertyInAbstractClass;
}
22 changes: 22 additions & 0 deletions tests/Models/Reflection/ArrayObjectExtendingClass.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

declare(strict_types=1);

namespace DoctrineNullableEmbeddables\Tests\Models\Reflection;

use ArrayObject;

/**
* A test asset extending {@see \ArrayObject}, useful for verifying internal classes issues with reflection
*/
class ArrayObjectExtendingClass extends ArrayObject
{
/** @var mixed */
private $privateProperty;

/** @var mixed */
protected $protectedProperty;

/** @var mixed */
public $publicProperty;
}
14 changes: 14 additions & 0 deletions tests/Models/Reflection/ConcreteEmbeddable.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

declare(strict_types=1);

namespace DoctrineNullableEmbeddables\Tests\Models\Reflection;

/**
* A test asset used to check that embeddables support properties defined in abstract classes
*/
class ConcreteEmbeddable extends AbstractEmbeddable
{
/** @var string */
private $propertyInConcreteClass;
}
8 changes: 4 additions & 4 deletions tests/ReflectionEmbeddedPropertyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

use Doctrine\Instantiator\Instantiator;
use Doctrine\ORM\Mapping\ReflectionEmbeddedProperty;
use Doctrine\Tests\Models\Generic\BooleanModel;
use Doctrine\Tests\Models\Reflection\AbstractEmbeddable;
use Doctrine\Tests\Models\Reflection\ArrayObjectExtendingClass;
use Doctrine\Tests\Models\Reflection\ConcreteEmbeddable;
use DoctrineNullableEmbeddables\Tests\Models\Generic\BooleanModel;
use DoctrineNullableEmbeddables\Tests\Models\Reflection\AbstractEmbeddable;
use DoctrineNullableEmbeddables\Tests\Models\Reflection\ArrayObjectExtendingClass;
use DoctrineNullableEmbeddables\Tests\Models\Reflection\ConcreteEmbeddable;
use PHPUnit\Framework\TestCase;
use ReflectionProperty;

Expand Down

0 comments on commit 6f1a05c

Please sign in to comment.