@@ -1941,9 +1941,9 @@ public function testJsonRecursive(): void
1941
1941
self ::assertEquals ('index.html ' , $ json ['alias ' ]['alias ' ]['basename ' ]);
1942
1942
// ... each alias even serializes its parents, ...
1943
1943
self ::assertTrue (isset ($ json ['alias ' ]['alias ' ]['parent ' ]['parent ' ]));
1944
- // ... however, parents aliases chains are not serialized , as parents are serialized with $stopRecursion=true
1945
- self ::assertTrue (! isset ( $ json ['alias ' ]['alias ' ]['parent ' ]['parent ' ]['alias ' ]) );
1946
- self ::assertNotNull ( $ index -> getAlias ()-> getAlias ()-> getParent ()-> getParent ()-> getAlias () );
1944
+ // ... however, parents aliases chains have just their foreign key (id) , as parents are serialized with $stopRecursion=true
1945
+ self ::assertEquals ( 3 , $ json ['alias ' ]['alias ' ]['parent ' ]['parent ' ]['alias ' ][ ' id ' ] );
1946
+ self ::assertCount ( 1 , $ json [ ' alias ' ][ ' alias ' ][ ' parent ' ][ ' parent ' ][ ' alias ' ] );
1947
1947
}
1948
1948
1949
1949
/**
@@ -1981,8 +1981,9 @@ public function testJsonCollection(): void
1981
1981
// Collection name properly handled ('discography' instead of default 'albums')
1982
1982
self ::assertTrue (isset ($ json ['discography ' ]));
1983
1983
self ::assertEquals ($ animals ->getTitle (), $ json ['discography ' ][0 ]['title ' ]);
1984
- // Make sure top object is not its own grandfather
1985
- self ::assertTrue (!isset ($ json ['discography ' ][0 ]['artist ' ]));
1984
+ // Make sure top object have just its primary key
1985
+ self ::assertEquals (1 , $ json ['discography ' ][0 ]['artist ' ]['id ' ]);
1986
+ self ::assertCount (1 , $ json ['discography ' ][0 ]['artist ' ]);
1986
1987
$ json = $ animals ->jsonSerialize ();
1987
1988
// Nevertheless, artist should be serialized in album as top object...
1988
1989
self ::assertTrue (isset ($ json ['artist ' ]));
0 commit comments