gplx/mediawiki/extensions/SemanticMediaWiki/tests/phpunit/Integration/JSONScript/TestCases/p-0705.json

132 lines
3.2 KiB
JSON

{
"description": "Test `#ask`/ NS_FILE option, `noimage` (`wgEnableUploads`, `wgFileExtensions`, `wgDefaultUserOptions`)",
"setup": [
{
"namespace": "SMW_NS_PROPERTY",
"page": "Has text",
"contents": "[[Has type::Text]]"
},
{
"namespace": "SMW_NS_PROPERTY",
"page": "Has file",
"contents": "[[Has type::Page]]"
},
{
"namespace": "SMW_NS_PROPERTY",
"page": "Has text",
"contents": "[[Has page::Page]]"
},
{
"namespace": "NS_FILE",
"page": "P0705.png",
"contents": {
"upload": {
"file" : "/../Fixtures/image-upload-480.png",
"text" : "[[Has file::{{FULLPAGENAME}}]] [[Has caption::123]] {{#subobject:Test|Has text=Foo}}"
}
}
},
{
"page": "Example/P0705/Q.1",
"contents": "{{#ask: [[Has file::+]] |?Has file |format=table |limit=1 }}"
},
{
"page": "Example/P0705/Q.2",
"contents": "{{#ask: [[Has file::+]] |?Has file#120px;thumb;<b>{{#show: File:P0705.png |?Has caption |link=none}}</b>[[Extra]] |format=table |limit=1 }}"
},
{
"page": "Example/P0705/Q.3",
"contents": "{{#ask: [[File:+]] }}"
},
{
"page": "Example/P0705/4",
"contents": "[[Has page::File:P0705.png]]"
},
{
"page": "Example/P0705/Q.4",
"contents": "{{#ask: [[Has page::<q>[[File:+]]</q>]] |?Has page#noimage |format=table |limit=1 }}"
}
],
"tests": [
{
"type": "parser",
"about": "#0",
"subject": "Example/P0705/Q.1",
"assert-output": {
"to-contain": [
"href=\"/wiki/File:P0705.png\"",
"300px-P0705.png",
"width=\"300\" height=\"300\""
],
"not-contain": [
"P0705.png\" width=\"480\" height=\"480\""
]
}
},
{
"type": "parser",
"about": "#1 with options",
"subject": "Example/P0705/Q.2",
"assert-output": {
"to-contain": [
"300px-P0705.png",
"width=\"300\" height=\"300\"",
"120px-P0705.png\"",
"width=\"120\" height=\"120\"",
"123",
"Extra"
]
}
},
{
"type": "parser",
"about": "#2 (subobject is displayed as normal link and not with an image reference)",
"subject": "Example/P0705/Q.3",
"assert-output": {
"to-contain": [
"<span class=\"smw-subobject-entity\"><a href=.*P0705.png#Test\" title=.*P0705.png\">P0705.png#Test</a></span>",
"<a href=.*P0705.png\""
]
}
},
{
"type": "parser",
"about": "#3 (#noimage)",
"subject": "Example/P0705/Q.4",
"assert-output": {
"to-contain": [
"<td class=\"smwtype_wpg\"><a href=\".*Example/P0705/4\" title=\"Example/P0705/4\">Example/P0705/4</a></td><td class=\"Has-page smwtype_wpg\"><a href=\".*P0705.png\" title=\".*P0705.png\">P0705.png</a></td>"
],
"not-contain": [
"P0705.png\" width=\"480\" height=\"480\""
]
}
}
],
"settings": {
"wgContLang": "en",
"wgLang": "en",
"wgEnableUploads": true,
"wgFileExtensions": [
"png"
],
"wgDefaultUserOptions": {
"thumbsize": 5
},
"smwgPageSpecialProperties": [
"_MDAT"
],
"smwgNamespacesWithSemanticLinks": {
"NS_MAIN": true,
"NS_FILE": true
}
},
"meta": {
"skip-on": {
"sitelanguage": [ "ja", "Some issues with the thumb output when 'ja' is used as sitelanguage." ]
},
"version": "2",
"is-incomplete": false,
"debug": false
}
}