2
2
3
3
namespace BaoPham \DynamoDb \Tests ;
4
4
5
+ use Illuminate \Support \Facades \Cache ;
6
+
5
7
/**
6
8
* Class DynamoDbModelTest
7
9
*
@@ -384,17 +386,17 @@ public function testStaticMethods()
384
386
385
387
public function testConditionContainingIndexKeyAndNonIndexKey ()
386
388
{
387
- $ fooItem = $ this ->seed ([
388
- 'name ' => ['S ' => 'Foo ' ],
389
- 'count ' => ['N ' => 10 ],
390
- ]);
391
-
392
- $ barItem = $ this ->seed ([
389
+ $ this ->seed ([
393
390
'name ' => ['S ' => 'Bar ' ],
394
391
'count ' => ['N ' => 11 ],
395
392
]);
396
393
397
- $ expectedItem = $ this ->testModel ->unmarshalItem ($ fooItem );
394
+ $ item = $ this ->seed ([
395
+ 'name ' => ['S ' => 'Foo ' ],
396
+ 'count ' => ['N ' => 10 ],
397
+ ]);
398
+
399
+ $ expectedItem = $ this ->testModel ->unmarshalItem ($ item );
398
400
399
401
$ foundItems = $ this ->testModel
400
402
->where ('count ' , 10 )
@@ -405,6 +407,16 @@ public function testConditionContainingIndexKeyAndNonIndexKey()
405
407
$ this ->assertEquals ($ expectedItem , $ foundItems ->first ()->toArray ());
406
408
}
407
409
410
+ public function testSerialize ()
411
+ {
412
+ $ item = $ this ->testModel ->unmarshalItem ($ this ->seed ());
413
+ $ serializedItems = serialize ($ this ->testModel ->all ());
414
+ $ unserializedItems = unserialize ($ serializedItems );
415
+
416
+ $ this ->assertEquals ([$ item ], $ unserializedItems ->toArray ());
417
+ $ this ->assertInstanceOf (get_class ($ this ->testModel ), $ unserializedItems ->first ());
418
+ }
419
+
408
420
protected function seed ($ attributes = [])
409
421
{
410
422
$ item = [
0 commit comments