mirror of
https://github.com/danog/AsyncOrm.git
synced 2024-11-30 04:39:45 +01:00
More fixes
This commit is contained in:
parent
dc814038c9
commit
0d7f723224
@ -41,6 +41,7 @@ use danog\AsyncOrm\ValueType;
|
|||||||
use PHPUnit\Framework\Attributes\DataProvider;
|
use PHPUnit\Framework\Attributes\DataProvider;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use ReflectionProperty;
|
use ReflectionProperty;
|
||||||
|
use WeakReference;
|
||||||
|
|
||||||
use function Amp\async;
|
use function Amp\async;
|
||||||
use function Amp\ByteStream\buffer;
|
use function Amp\ByteStream\buffer;
|
||||||
@ -349,6 +350,32 @@ final class OrmTest extends TestCase
|
|||||||
$this->assertSame($obj, $orm[321]);
|
$this->assertSame($obj, $orm[321]);
|
||||||
|
|
||||||
$orm->clear();
|
$orm->clear();
|
||||||
|
unset($obj);
|
||||||
|
|
||||||
|
$obj = new TestObject;
|
||||||
|
$ref = WeakReference::create($obj);
|
||||||
|
$orm[123] = $obj;
|
||||||
|
unset($obj, $orm[123]);
|
||||||
|
|
||||||
|
$this->assertNull($ref->get());
|
||||||
|
|
||||||
|
$obj = new TestObject;
|
||||||
|
$ref = WeakReference::create($obj);
|
||||||
|
$orm = $field->build();
|
||||||
|
$orm[123] = $obj;
|
||||||
|
unset($obj, $orm);
|
||||||
|
|
||||||
|
while (\gc_collect_cycles());
|
||||||
|
$this->assertNull($ref->get());
|
||||||
|
|
||||||
|
$obj = $field->build()[123];
|
||||||
|
$obj->savedProp = 123;
|
||||||
|
$obj->save();
|
||||||
|
$this->assertSame($obj->savedProp, 123);
|
||||||
|
unset($obj);
|
||||||
|
|
||||||
|
$this->assertSame($field->build()[123]->savedProp, 123);
|
||||||
|
unset($obj, $orm);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function provideSettingsKeysValues(): \Generator
|
public static function provideSettingsKeysValues(): \Generator
|
||||||
|
Loading…
Reference in New Issue
Block a user