Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 32e9868

Browse files
committed
fix: few fixes after #972
1 parent 47b0d79 commit 32e9868

3 files changed

Lines changed: 4 additions & 0 deletions

File tree

src/Persistence/PersistentObjectFactory.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ public function create(callable|array $attributes = []): object
233233

234234
if ($configuration->inADataProvider()
235235
&& Configuration::autoRefreshWithLazyObjectsIsEnabled()
236+
&& $this->isPersisting()
236237
&& !$this instanceof PersistentProxyObjectFactory
237238
) {
238239
return ProxyGenerator::wrapFactoryNativeProxy($this, $attributes);

tests/Integration/DataProvider/DataProviderInUnitTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ public static function createObjectWithPersistentObjectFactoryInDataProvider():
7171

7272
#[Test]
7373
#[DataProvider('useGetterOnObjectCreatedInDataProvider')]
74+
#[IgnoreDeprecations]
7475
public function assert_it_can_use_getter_on_object_created_in_data_provider(string $providedData, mixed $expectedData): void
7576
{
7677
self::assertEquals($expectedData, ProxyGenerator::unwrap($providedData));

tests/Integration/DataProvider/DataProviderWithPersistentFactoryInKernelTestCase.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
use PHPUnit\Framework\Attributes\DataProvider;
1717
use PHPUnit\Framework\Attributes\IgnoreDeprecations;
18+
use PHPUnit\Framework\Attributes\RequiresEnvironmentVariable;
1819
use PHPUnit\Framework\Attributes\RequiresPhpunit;
1920
use PHPUnit\Framework\Attributes\RequiresPhpunitExtension;
2021
use PHPUnit\Framework\Attributes\Test;
@@ -110,6 +111,7 @@ public static function useGetterOnProxyObjectCreatedInDataProvider(): iterable
110111

111112
#[Test]
112113
#[DataProvider('throwsExceptionWhenCreatingObjectInDataProvider')]
114+
#[RequiresEnvironmentVariable('USE_PHP_84_LAZY_OBJECTS', '0')]
113115
public function it_throws_when_creating_persisted_object_with_non_proxy_factory_in_data_provider(?\Throwable $e,
114116
): void {
115117
self::assertInstanceOf(\LogicException::class, $e);

0 commit comments

Comments
 (0)