-
Notifications
You must be signed in to change notification settings - Fork 46
Expand file tree
/
Copy pathTests.txt
More file actions
66 lines (62 loc) · 4.51 KB
/
Tests.txt
File metadata and controls
66 lines (62 loc) · 4.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
Flat Tree Json Serializer (BlueM\Tree\Serializer\FlatTreeJsonSerializer)
[x] Serialization happens by calling getNodes() method on the tree
Hierarchical Tree Json Serializer (BlueM\Tree\Serializer\HierarchicalTreeJsonSerializer)
[x] Serializes to a hierarchical array
Node (BlueM\Tree\Node)
[x] Level: The level of a top-level node is 1
[x] Level: A node 2 levels below a top-level node has level 3
[x] Ancestors: A top-level node’s ancestors is an empty array
[x] Ancestors: A node’s ancestors is an array of nodes, ordered from nearer to more distant ones
[x] Ancestors: The node itself can be included in the list of ancestors
[x] Descendants: A node’s descendants is an array of nodes, with depth-first sorting
[x] Descendants: The node itself can be included in the list of descendants
[x] Parent: For a top-level node, null is returned when calling getParent()
[x] Parent: For a non-root node, the parent node is returned when calling getParent()
[x] Siblings: The previous sibling can be retrieved
[x] Siblings: The next sibling can be retrieved
[x] Siblings: All siblings can be retrieved, not including the node itself
[x] Siblings: All siblings can be retrieved, including the node itself
[x] Siblings: All siblings can be retrieved, even when node IDs have different types
[x] Children: When calling getChildren(), an empty array is returned if there are no child nodes
[x] Children: When calling getChildren(), an array of child nodes is returned
[x] Children: Public property “children” can be used instead of getChildren()
[x] Children: get('children') can be used instead of getChildren()
[x] Children: A node can tell if it has any child nodes
[x] Children: A node knows the number of child nodes it has
[x] Children: A child node can be attached to a node
[x] Properties / Getter: A node’s properties can be fetched case-insensitively, but preferring exact case, if properties differ in case
[x] Properties / Getter: An exception is thrown when calling a getter for a non-existent property
[x] Properties / get(): A node’s custom properties can be fetched case-sensitively using get()
[x] Properties / get(): An exception is thrown when calling get() with an inexistent node property as argument
[x] Properties / Magic property: A property can be fetched case-sensitively as public property
[x] Properties / Magic property: An exception is thrown when trying to fetch a non-existent public property
[x] Properties / isset(): The existence of a property can be fetched case-sensitively using isset()
[x] Properties can be fetched as an array
[x] A node property may contain null
[x] When serialized to JSON, an object containing all properties is returned
[x] When typecasted to string, the string representation of the node’s ID is returned
Tree (BlueM\Tree)
[x] Constructor args: Root nodes’ parent ID can be defined as null
[x] Constructor args: The root node’s ID can be defined as null while there is a node with ID 0
[x] Constructor args: Name of fields for id and parent id in the input data can be changed
[x] Constructor args: the JSON serializer can be changed
[x] The JSON serializer can be changed by calling a method
[x] Build: The tree can be rebuilt from new data
[x] Build: A tree can be created from an Iterable
[x] Build: A tree can be created from an array of objects implementing Iterator
[x] Build: The tree can be serialized to a json representation from which a tree with the same data can be built when decoded
[x] Build: a custom warning callback can be used, which is called with an exception and the tree instance as arguments
[x] Nodes: The root nodes can be retrieved
[x] Nodes: All nodes can be retrieved
[x] Nodes: A node can be accessed by its integer id
[x] Nodes: A node can be accessed by its string id
[x] Nodes: Trying to get a node by its id throws an exception if the id is invalid
[x] Nodes: When getNodeById() is called with root nodes’ parent value, an exception will be thrown
[x] Nodes: A node can be accessed by its value path
[x] Nodes: Trying to get a node by its value path returns null if no node matches
[x] In scalar context the tree is returned as a string
[x] An exception is thrown when an invalid parent id is referenced
[x] An exception is thrown if the build warning callback option is not a callable
[x] An exception is thrown when a node would be its own parent
[x] An exception is thrown when a node would be its own parent when own id and parent id have different types
[x] When mixing numeric and string ids no exception is thrown due to implicit typecasting