@@ -46,6 +46,14 @@ public function testClassBased()
46
46
$ mapper ->registerClass (TypedConstructor::class);
47
47
$ this ->assertInstanceOf (TypedConstructor::class, $ mapper ->findOne ('constructor ' ));
48
48
$ this ->assertEquals ($ row , $ mapper ->findOne ('constructor ' ));
49
+
50
+ $ constructor = $ mapper ->findOne ('constructor ' );
51
+
52
+ $ mapper ->update ($ constructor , ['nick ' => 'space casting ' ]);
53
+ $ this ->assertSame ($ constructor ->nick , 'space casting ' );
54
+
55
+ $ mapper ->delete ($ constructor );
56
+ $ this ->assertNull ($ mapper ->findOne ('constructor ' ));
49
57
}
50
58
51
59
public function testAttribute ()
@@ -490,14 +498,20 @@ public function testSpaces()
490
498
491
499
$ pool = new Pool (function () use ($ mapper ) {
492
500
return $ mapper ;
501
+ }, function ($ instance ) use ($ mapper ) {
502
+ $ name = get_class ($ instance )::getSpaceName ();
503
+ return "prefix. $ name " ;
493
504
});
494
505
495
506
$ pool ->create ('first.array ' , ['nick ' => 'qwerty ' ]);
496
- $ pool ->create ('second.constructor ' , ['nick ' => 'asdf ' ]);
507
+ $ constructor = $ pool ->create ('second.constructor ' , ['nick ' => 'asdf ' ]);
497
508
498
509
$ changes = $ pool ->getChanges ();
499
510
$ this ->assertCount (4 , $ changes );
500
511
$ this ->assertSame ($ changes [0 ]->space , 'first.array ' );
501
512
$ this ->assertSame ($ changes [2 ]->space , 'second.array ' );
513
+
514
+ // validate pool space casting
515
+ $ pool ->update ($ constructor , ['nick ' => 'tester ' ]);
502
516
}
503
517
}
0 commit comments