gplx/mediawiki/extensions/SemanticMediaWiki/tests/phpunit/Integration/JSONScript/TestCases/api-smwbrowse-0001.json

368 lines
9.3 KiB
JSON

{
"description": "Test API `action=smwbrowse`",
"setup": [
{
"namespace": "SMW_NS_PROPERTY",
"page": "API test property",
"contents": "[[Has type::Page]]"
},
{
"namespace": "SMW_NS_PROPERTY",
"page": "API text property",
"contents": "[[Has type::Text]]"
},
{
"namespace": "SMW_NS_PROPERTY",
"page": "API inverse property",
"contents": "[[Has type::Page]]"
},
{
"namespace": "SMW_NS_PROPERTY",
"page": "API direct property",
"contents": "[[Has type::Page]]"
},
{
"namespace": "SMW_NS_PROPERTY",
"page": "API page property",
"contents": "[[Has type::Page]]"
},
{
"namespace": "SMW_NS_PROPERTY",
"page": "API date property",
"contents": "[[Has type::Date]]"
},
{
"namespace": "SMW_NS_CONCEPT",
"page": "API test concept",
"contents": "..."
},
{
"namespace": "NS_CATEGORY",
"page": "API test category",
"contents": "..."
},
{
"namespace": "NS_MAIN",
"page": "Api-smwbrowse-0001/1",
"contents": "[[API text property::text 1]]"
},
{
"namespace": "NS_MAIN",
"page": "Api-smwbrowse-0001/2",
"contents": "[[API text property::text 2]]"
},
{
"namespace": "NS_MAIN",
"page": "Api-smwbrowse-0001/3",
"contents": "[[API page property::page 1]]"
},
{
"namespace": "NS_MAIN",
"page": "Api-smwbrowse-0001/4",
"contents": "[[API page property::page 2]]"
},
{
"namespace": "NS_MAIN",
"page": "Api-smwbrowse-0001/5",
"contents": "[[API date property::1 Jan 1970]]"
},
{
"namespace": "NS_MAIN",
"page": "Api-smwbrowse-0001/6",
"contents": "[[API date property::2 Jan 1971]]"
},
{
"namespace": "NS_MAIN",
"page": "Api-smwbrowse-0001-7",
"contents": "[[API direct property::Api-smwbrowse-0001-8]]"
},
{
"namespace": "NS_MAIN",
"page": "Api-smwbrowse-0001-8"
},
{
"namespace": "NS_MAIN",
"page": "Api-smwbrowse-0001-9",
"contents": "[[API inverse property::Api-smwbrowse-0001-7]]"
},
{
"namespace": "NS_MAIN",
"page": "Api-smwbrowse-0001-10",
"contents": "[[API_direct_property::Api-smwbrowse-0001-8]]"
}
],
"tests": [
{
"type": "api",
"about": "#0 `smwbrowse` property search",
"api": {
"parameters": {
"action": "smwbrowse",
"format": "json",
"browse": "property",
"params": "{ \"limit\": 10, \"offset\": 0, \"search\": \"API test property\", \"description\": true, \"prefLabel\": true }"
}
},
"assert-output": {
"to-contain": {
"contents-file" : "/../Fixtures/api-smwbrowse-0001.0.txt"
}
}
},
{
"type": "api",
"about": "#1 `smwbrowse` concept search",
"api": {
"parameters": {
"action": "smwbrowse",
"format": "json",
"browse": "concept",
"params": "{ \"limit\": 10, \"offset\": 0, \"search\": \"API test\", \"description\": true, \"prefLabel\": true }"
}
},
"assert-output": {
"to-contain": {
"contents-file" : "/../Fixtures/api-smwbrowse-0001.1.txt"
}
}
},
{
"type": "api",
"about": "#2 `smwbrowse` category search",
"api": {
"parameters": {
"action": "smwbrowse",
"format": "json",
"browse": "category",
"params": "{ \"limit\": 10, \"offset\": 0, \"search\": \"API test\", \"description\": true, \"prefLabel\": true }"
}
},
"assert-output": {
"to-contain": {
"contents-file" : "/../Fixtures/api-smwbrowse-0001.2.txt"
}
}
},
{
"type": "api",
"skip-on": {
"postgres": "Skipping, because I have no idea why this returning empty on Travis!",
"sqlite": "Skipping, because I have no idea why this returning empty on Travis!",
"blazegraph": "Skipping: the current Travis configuration does test Blazegraph with SQLite, it fails because of SQLite and works with MySQL."
},
"about": "#3 `smwbrowse` page search",
"api": {
"parameters": {
"action": "smwbrowse",
"format": "json",
"browse": "page",
"params": "{ \"limit\": 10, \"offset\": 0, \"search\": \"API test\" }"
}
},
"assert-output": {
"to-contain": {
"contents-file" : "/../Fixtures/api-smwbrowse-0001.3.txt"
}
}
},
{
"type": "api",
"skip-on": {
"sqlite": "Skipping, because I have no idea why this returning empty during the test!"
},
"about": "#4 `smwbrowse` pvalue (text type) search",
"api": {
"parameters": {
"action": "smwbrowse",
"format": "json",
"browse": "pvalue",
"params": "{ \"limit\": 10, \"offset\": 0, \"property\": \"API text property\", \"search\": \"tex\", \"sort\": \"asc\" }"
}
},
"assert-output": {
"to-contain": {
"contents-file" : "/../Fixtures/api-smwbrowse-0001.4.txt"
}
}
},
{
"type": "api",
"about": "#5 `smwbrowse` pvalue (page type) search",
"api": {
"parameters": {
"action": "smwbrowse",
"format": "json",
"browse": "pvalue",
"params": "{ \"limit\": 10, \"offset\": 0, \"property\": \"API page property\", \"search\": \"pag\", \"sort\": \"asc\" }"
}
},
"assert-output": {
"to-contain": {
"contents-file" : "/../Fixtures/api-smwbrowse-0001.5.txt"
}
}
},
{
"type": "api",
"skip-on": {
"sqlite": "Skipping, because I have no idea why this is returning empty during the test!"
},
"about": "#6 `smwbrowse` pvalue (date type) search",
"api": {
"parameters": {
"action": "smwbrowse",
"format": "json",
"browse": "pvalue",
"params": "{ \"limit\": 10, \"offset\": 0, \"property\": \"API date property\", \"search\": \"197\", \"sort\": \"asc\" }"
}
},
"assert-output": {
"to-contain": {
"contents-file" : "/../Fixtures/api-smwbrowse-0001.6.txt"
}
}
},
{
"type": "api",
"about": "#7 `smwbrowse` subject lookup, JSON",
"api": {
"parameters": {
"action": "smwbrowse",
"format": "json",
"browse": "subject",
"params": "{ \"subject\": \"Api-smwbrowse-0001/1\" , \"ns\": 0 }"
}
},
"assert-output": {
"to-contain": {
"contents-file" : "/../Fixtures/res.api-smwbrowse-0001.7.txt"
}
}
},
{
"type": "api",
"about": "#8 `smwbrowse` subject lookup, HTML",
"skip-on": {
"mediawiki": [ ">1.42.x", "Skipping, broken due to wiki page creation failure in test setup" ]
},
"api": {
"parameters": {
"action": "smwbrowse",
"format": "json",
"browse": "subject",
"params": "{ \"subject\": \"Api-smwbrowse-0001/1\" , \"ns\": 0 , \"type\": \"html\", \"options\": { \"lang\" : \"en\" } }"
}
},
"assert-output": {
"to-contain": {
"contents-file" : "/../Fixtures/res.api-smwbrowse-0001.8.txt"
}
}
},
{
"type": "api",
"about": "#9 `smwbrowse` (distinct value, empty search) psubject search",
"api": {
"parameters": {
"action": "smwbrowse",
"format": "json",
"browse": "psubject",
"params": "{ \"limit\": 10, \"offset\": 0, \"property\": \"API page property\", \"value\": \"Page 1\", \"sort\": \"asc\" }"
}
},
"assert-output": {
"to-contain": {
"contents-file" : "/../Fixtures/res.api-smwbrowse-0001.9.txt"
}
}
},
{
"type": "api",
"about": "#10 `smwbrowse` (empty value, empty search) psubject search",
"api": {
"parameters": {
"action": "smwbrowse",
"format": "json",
"browse": "psubject",
"params": "{ \"limit\": 10, \"offset\": 0, \"property\": \"API page property\", \"value\": \"\", \"sort\": \"asc\" }"
}
},
"assert-output": {
"to-contain": {
"contents-file" : "/../Fixtures/res.api-smwbrowse-0001.10.txt"
}
}
},
{
"type": "api",
"about": "#11 `smwbrowse` (empty value, distinct search) psubject search",
"api": {
"parameters": {
"action": "smwbrowse",
"format": "json",
"browse": "psubject",
"params": "{ \"limit\": 10, \"offset\": 0, \"property\": \"API page property\", \"value\": \"\", \"search\": \"/4\", \"sort\": \"asc\" }"
}
},
"assert-output": {
"to-contain": {
"contents-file" : "/../Fixtures/res.api-smwbrowse-0001.11.txt"
}
}
},
{
"type": "api",
"about": "#12 `smwbrowse` subject lookup JSON with direct and inverse properties",
"api": {
"parameters": {
"action": "smwbrowse",
"format": "json",
"browse": "subject",
"params": "{ \"subject\": \"Api-smwbrowse-0001-7\" , \"ns\": 0 , \"limit\": 100 , \"offset\": 0 ,\"options\": { \"lang\" : \"en\" } }"
}
},
"assert-output": {
"to-contain": {
"contents-file" : "/../Fixtures/res.api-smwbrowse-0001.12.txt"
}
}
},
{
"type": "api",
"about": "#13 `smwbrowse` subject lookup JSON with direct properties",
"api": {
"parameters": {
"action": "smwbrowse",
"format": "json",
"browse": "subject",
"params": "{ \"subject\": \"Api-smwbrowse-0001-10\" , \"ns\": 0 , \"limit\": 100 , \"offset\": 0 ,\"options\": { \"lang\" : \"en\" } }"
}
},
"assert-output": {
"to-contain": {
"contents-file" : "/../Fixtures/res.api-smwbrowse-0001.13.txt"
}
}
}
],
"settings": {
"wgContLang": "en",
"wgLang": "en",
"smwgCacheUsage": {
"api.browse": false,
"api.browse.pvalue": false,
"api.browse.psubject": false
},
"smwgNamespacesWithSemanticLinks": {
"NS_MAIN": true,
"SMW_NS_PROPERTY": true,
"SMW_NS_CONCEPT": true,
"NS_CATEGORY": true
}
},
"meta": {
"version": "2",
"is-incomplete": false,
"debug": false
}
}