Yes, SRF does not have a lot of testing, so thx for improving and sorry for not
having much to copy from! Maybe [0] could give you an idea on how to create
your mock object. See [1] for documentation on how to work with mock objects.
Cheers
Stephan
[0]
I want to enhance existing SRF graph format test. My idea is, to create
a mock SMWQueryResult (=test data) that will be passed to function
getResultText (at the moment, could be getGraphvizCode or something later).
I had a look at existing tests [1] and docs [2][3] as well as
Stephan, thanks for your feedback. In the meanwhile I had another idea.
How about creating test data from serialized SMWQueryResults?
I saw, that SMWQueryResult provides a serializeToArray() function [1].
Is there an easy way to "unserializeFromArray()"?
[1]
roundtrip example
$sf = new SerializerFactory();
$queryResultJSON = json_encode( $sf->getSerializerFor( $queryResult
)->serialize( $queryResult ) );
$decodedQueryResult = json_decode( $queryResultJSON );
$queryResultFromJSON = $sf->getDeserializerFor( $decodedQueryResult
)->deserialize(
found
https://doc.semantic-mediawiki.org/classSMW_1_1Serializers_1_1QueryResultSerializer.html
Let's see if this can be used...
Am 03.08.2017 um 14:37 schrieb planetenxin:
> Another option would be json_encode / json_decode but this would require
> implementing JsonSerializable interface as far
Another option would be json_encode / json_decode but this would require
implementing JsonSerializable interface as far as I can see.
@mwjames: any ideas suggestions from your side?
Am 03.08.2017 um 12:46 schrieb Stephan Gambke:
> Although, i just found a class QueryFactory, that has a function