22
33namespace BaoPham \DynamoDb \Tests ;
44
5+ use Illuminate \Support \Facades \Cache ;
6+
57/**
68 * Class DynamoDbModelTest
79 *
@@ -384,17 +386,17 @@ public function testStaticMethods()
384386
385387 public function testConditionContainingIndexKeyAndNonIndexKey ()
386388 {
387- $ fooItem = $ this ->seed ([
388- 'name ' => ['S ' => 'Foo ' ],
389- 'count ' => ['N ' => 10 ],
390- ]);
391-
392- $ barItem = $ this ->seed ([
389+ $ this ->seed ([
393390 'name ' => ['S ' => 'Bar ' ],
394391 'count ' => ['N ' => 11 ],
395392 ]);
396393
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 );
398400
399401 $ foundItems = $ this ->testModel
400402 ->where ('count ' , 10 )
@@ -405,6 +407,16 @@ public function testConditionContainingIndexKeyAndNonIndexKey()
405407 $ this ->assertEquals ($ expectedItem , $ foundItems ->first ()->toArray ());
406408 }
407409
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+
408420 protected function seed ($ attributes = [])
409421 {
410422 $ item = [
0 commit comments