File tree Expand file tree Collapse file tree 5 files changed +36
-2
lines changed Expand file tree Collapse file tree 5 files changed +36
-2
lines changed Original file line number Diff line number Diff line change 9292 dependencies : " highest"
9393 symfony-version : " stable"
9494 proxy : " lazy-ghost"
95+ # Test removing optional dependencies
96+ - topology : " server"
97+ php-version : " 8.4"
98+ mongodb-version : " 8.0"
99+ driver-version : " stable"
100+ dependencies : " highest"
101+ symfony-version : " stable"
102+ proxy : " native"
103+ remove-optional-dependencies : true
95104 # Test with a sharded cluster
96105 # Currently disabled due to a bug where MongoDB reports "sharding status unknown"
97106# - topology: "sharded_cluster"
@@ -148,6 +157,13 @@ jobs:
148157 composer require --no-update symfony/var-dumper:^${{ matrix.symfony-version }}
149158 composer require --no-update --dev symfony/cache:^${{ matrix.symfony-version }}
150159
160+ - name : " Remove optional dependencies"
161+ if : " ${{ matrix.remove-optional-dependencies }}"
162+ run : |
163+ composer remove --no-update friendsofphp/proxy-manager-lts symfony/var-exporter
164+ composer remove --no-update --dev symfony/cache doctrine/orm doctrine/annotations symfony/uid
165+ composer remove --no-update --dev doctrine/coding-standard phpstan/phpstan phpstan/phpstan-deprecation-rule phpstan/phpstan-phpunit
166+
151167 - name : " Install dependencies with Composer"
152168 uses : " ramsey/composer-install@v3"
153169 with :
Original file line number Diff line number Diff line change @@ -105,8 +105,13 @@ protected static function getConfiguration(): Configuration
105105 $ config ->setPersistentCollectionNamespace ('PersistentCollections ' );
106106 $ config ->setDefaultDB (DOCTRINE_MONGODB_DATABASE );
107107 $ config ->setMetadataDriverImpl (static ::createMetadataDriverImpl ());
108- $ config ->setUseLazyGhostObject ((bool ) $ _ENV ['USE_LAZY_GHOST_OBJECT ' ]);
109- $ config ->setUseNativeLazyObject ((bool ) $ _ENV ['USE_NATIVE_LAZY_OBJECT ' ]);
108+ if ($ _ENV ['USE_LAZY_GHOST_OBJECT ' ]) {
109+ $ config ->setUseLazyGhostObject (true );
110+ }
111+
112+ if ($ _ENV ['USE_NATIVE_LAZY_OBJECT ' ]) {
113+ $ config ->setUseNativeLazyObject (true );
114+ }
110115
111116 if ($ config ->isNativeLazyObjectEnabled ()) {
112117 NativeLazyObjectFactory::enableTracking ();
Original file line number Diff line number Diff line change 1313use PHPUnit \Framework \Attributes \RequiresPhp ;
1414use PHPUnit \Framework \Attributes \TestWith ;
1515use PHPUnit \Framework \TestCase ;
16+ use ProxyManager \Configuration as ProxyManagerConfiguration ;
1617use stdClass ;
1718
1819use function base64_encode ;
20+ use function class_exists ;
1921use function str_repeat ;
2022
2123class ConfigurationTest extends TestCase
@@ -38,6 +40,12 @@ public function testUseLazyGhostObject(): void
3840 self ::assertFalse ($ c ->isLazyGhostObjectEnabled ());
3941 $ c ->setUseLazyGhostObject (true );
4042 self ::assertTrue ($ c ->isLazyGhostObjectEnabled ());
43+
44+ if (! class_exists (ProxyManagerConfiguration::class)) {
45+ $ this ->expectException (LogicException::class);
46+ $ this ->expectExceptionMessage ('Package "friendsofphp/proxy-manager-lts" is required to disable LazyGhostObject. ' );
47+ }
48+
4149 $ c ->setUseLazyGhostObject (false );
4250 self ::assertFalse ($ c ->isLazyGhostObjectEnabled ());
4351 }
Original file line number Diff line number Diff line change 44
55namespace Doctrine \ODM \MongoDB \Tests \Mapping ;
66
7+ use Doctrine \Common \Annotations \AnnotationReader ;
78use Doctrine \ODM \MongoDB \Mapping \Annotations as ODM ;
89use Doctrine \ODM \MongoDB \Mapping \Annotations \Document ;
910use Doctrine \ODM \MongoDB \Mapping \ClassMetadata ;
1011use Doctrine \ODM \MongoDB \Mapping \Driver \AnnotationDriver ;
1112use Doctrine \Persistence \Mapping \Driver \FileClassLocator ;
1213use Doctrine \Persistence \Mapping \Driver \MappingDriver ;
14+ use PHPUnit \Framework \Attributes \RequiresMethod ;
1315
1416use function call_user_func ;
1517use function class_exists ;
1921
2022use const E_USER_DEPRECATED ;
2123
24+ #[RequiresMethod(AnnotationReader::class, '__construct ' )]
2225class AnnotationDriverTest extends AbstractAnnotationDriverTestCase
2326{
2427 protected static function loadDriver (array $ paths = []): MappingDriver
Original file line number Diff line number Diff line change 77use Doctrine \ODM \MongoDB \Types \Type ;
88use InvalidArgumentException ;
99use MongoDB \BSON \Binary ;
10+ use PHPUnit \Framework \Attributes \RequiresMethod ;
1011use PHPUnit \Framework \TestCase ;
1112use Symfony \Component \Uid \UuidV4 ;
1213use Throwable ;
1314
15+ #[RequiresMethod(UuidV4::class, '__construct ' )]
1416class BinaryUuidTypeTest extends TestCase
1517{
1618 public function testConvertToDatabaseValue (): void
You can’t perform that action at this time.
0 commit comments