User:WolfgangFahl/Workdocumentation 2015-12-25 WF

From semantic-mediawiki.org
Jump to: navigation, search
WolfgangFahlUser:WolfgangFahl/Workdocumentation 2015-12-25 WF

tags in properties

The following property assignments do not work as of 2015-12-25: [[Has_text::<pre>Preformatted Text</pre>]] {{#set:Has_text=<pre>Some new Text</pre>}}

The given value was not understood.
The given value was not understood.

Query

Properties

Links

PHP Unit Testing

php composer.phar require phpunit/phpunit:~
4.6
./composer.json has been updated
> ComposerHookHandler::onPreUpdate
Deprecation Notice: The Composer\Package\LinkConstraint\VersionConstraint class is deprecated, use Composer\Semver\Constraint\Constraint instead. in phar:///var/www/html/mediawiki-1.25.3/composer.phar/src/Composer/Package/LinkConstraint/VersionConstraint.php:17
Deprecation Notice: The Composer\Package\LinkConstraint\LinkConstraintInterface interface is deprecated, use Composer\Semver\Constraint\ConstraintInterface instead. in phar:///var/www/html/mediawiki-1.25.3/composer.phar/src/Composer/Package/LinkConstraint/LinkConstraintInterface.php:17
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Conclusion: don't install phpunit/phpunit 4.8.21
    - Conclusion: don't install phpunit/phpunit 4.8.20
    - Conclusion: don't install phpunit/phpunit 4.8.19
    - Conclusion: don't install phpunit/phpunit 4.8.18
    - Conclusion: don't install phpunit/phpunit 4.8.17
    - Conclusion: don't install phpunit/phpunit 4.8.16
    - Conclusion: don't install phpunit/phpunit 4.8.15
    - Conclusion: don't install phpunit/phpunit 4.8.14
    - Conclusion: don't install phpunit/phpunit 4.8.13
    - Conclusion: don't install phpunit/phpunit 4.8.12
    - Conclusion: don't install phpunit/phpunit 4.8.11
    - Conclusion: don't install phpunit/phpunit 4.8.10
    - Conclusion: don't install phpunit/phpunit 4.8.9
    - Conclusion: don't install phpunit/phpunit 4.8.8
    - Conclusion: don't install phpunit/phpunit 4.8.7
    - Conclusion: don't install phpunit/phpunit 4.8.6
    - Conclusion: don't install phpunit/phpunit 4.8.5
    - Conclusion: don't install phpunit/phpunit 4.8.4
    - Conclusion: don't install phpunit/phpunit 4.8.3
    - Conclusion: don't install phpunit/phpunit 4.8.2
    - Conclusion: don't install phpunit/phpunit 4.8.1
    - Conclusion: don't install phpunit/phpunit 4.8.0
    - Conclusion: don't install phpunit/phpunit 4.7.7
    - Conclusion: don't install phpunit/phpunit 4.7.6
    - Conclusion: don't install phpunit/phpunit 4.7.5
    - Conclusion: don't install phpunit/phpunit 4.7.4
    - Conclusion: don't install phpunit/phpunit 4.7.3
    - Conclusion: don't install phpunit/phpunit 4.7.2
    - Conclusion: don't install phpunit/phpunit 4.7.1
    - Conclusion: don't install phpunit/phpunit 4.7.0
    - Conclusion: don't install phpunit/phpunit 4.6.10
    - Conclusion: don't install phpunit/phpunit 4.6.9
    - Conclusion: don't install phpunit/phpunit 4.6.8
    - Conclusion: don't install phpunit/phpunit 4.6.7
    - Conclusion: don't install phpunit/phpunit 4.6.6
    - Conclusion: don't install phpunit/phpunit 4.6.5
    - Conclusion: don't install phpunit/phpunit 4.6.4
    - Conclusion: don't install phpunit/phpunit 4.6.3
    - Conclusion: don't install phpunit/phpunit 4.6.2
    - Conclusion: don't install phpunit/phpunit 4.6.1
    - Conclusion: remove phpunit/phpunit-mock-objects 1.2.3
    - Installation request for phpunit/phpunit ~4.6 -> satisfiable by phpunit/phpunit[4.6.0, 4.6.1, 4.6.10, 4.6.2, 4.6.3, 4.6.4, 4.6.5, 4.6.6, 4.6.7, 4.6.8, 4.6.9, 4.7.0, 4.7.1, 4.7.2, 4.7.3, 4.7.4, 4.7.5, 4.7.6, 4.7.7, 4.8.0, 4.8.1, 4.8.10, 4.8.11, 4.8.12, 4.8.13, 4.8.14, 4.8.15, 4.8.16, 4.8.17, 4.8.18, 4.8.19, 4.8.2, 4.8.20, 4.8.21, 4.8.3, 4.8.4, 4.8.5, 4.8.6, 4.8.7, 4.8.8, 4.8.9].
    - Conclusion: don't install phpunit/phpunit-mock-objects 1.2.3
    - phpunit/phpunit 4.6.0 requires phpunit/phpunit-mock-objects ~2.3 -> satisfiable by phpunit/phpunit-mock-objects[2.3.0, 2.3.1, 2.3.2, 2.3.3, 2.3.4, 2.3.5, 2.3.6, 2.3.7, 2.3.8].
    - Can only install one of: phpunit/phpunit-mock-objects[2.3.0, 1.2.3].
    - Can only install one of: phpunit/phpunit-mock-objects[2.3.1, 1.2.3].
    - Can only install one of: phpunit/phpunit-mock-objects[2.3.2, 1.2.3].
    - Can only install one of: phpunit/phpunit-mock-objects[2.3.3, 1.2.3].
    - Can only install one of: phpunit/phpunit-mock-objects[2.3.4, 1.2.3].
    - Can only install one of: phpunit/phpunit-mock-objects[2.3.5, 1.2.3].
    - Can only install one of: phpunit/phpunit-mock-objects[2.3.6, 1.2.3].
    - Can only install one of: phpunit/phpunit-mock-objects[2.3.7, 1.2.3].
    - Can only install one of: phpunit/phpunit-mock-objects[2.3.8, 1.2.3].
    - Installation request for phpunit/phpunit-mock-objects == 1.2.3.0 -> satisfiable by phpunit/phpunit-mock-objects[1.2.3].


Installation failed, reverting ./composer.json to its original content.

modify composer.json

root@pwiki:/var/www/html/mediawiki# grep phpunit composer.json 
		"phpunit/phpunit": "~4.6",

 php composer.phar update                  
> ComposerHookHandler::onPreUpdate
Deprecation Notice: The Composer\Package\LinkConstraint\VersionConstraint class is deprecated, use Composer\Semver\Constraint\Constraint instead. in phar:///var/www/html/mediawiki-1.25.3/composer.phar/src/Composer/Package/LinkConstraint/VersionConstraint.php:17
Deprecation Notice: The Composer\Package\LinkConstraint\LinkConstraintInterface interface is deprecated, use Composer\Semver\Constraint\ConstraintInterface instead. in phar:///var/www/html/mediawiki-1.25.3/composer.phar/src/Composer/Package/LinkConstraint/LinkConstraintInterface.php:17
Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Installing sebastian/version (1.0.6)
    Downloading: 100%         

  - Installing sebastian/global-state (1.1.1)
    Downloading: 100%         

  - Installing sebastian/recursion-context (1.0.2)
    Downloading: 100%         

  - Installing sebastian/exporter (1.2.1)
    Downloading: 100%         

  - Installing sebastian/environment (1.3.3)
    Downloading: 100%         

  - Installing sebastian/diff (1.4.1)
    Downloading: 100%         

  - Installing sebastian/comparator (1.2.0)
    Downloading: 100%         

  - Removing symfony/yaml (v2.8.0)
  - Installing symfony/yaml (v3.0.0)
    Downloading: 100%         

  - Installing doctrine/instantiator (1.0.5)
    Downloading: 100%         

  - Installing phpdocumentor/reflection-docblock (2.0.4)
    Downloading: 100%         

  - Installing phpspec/prophecy (v1.5.0)
    Downloading: 100%         

  - Removing phpunit/phpunit-mock-objects (1.2.3)
  - Installing phpunit/phpunit-mock-objects (2.3.8)
    Downloading: 100%         

  - Removing phpunit/php-token-stream (1.2.2)
  - Installing phpunit/php-token-stream (1.4.8)
    Downloading: 100%         

  - Removing phpunit/php-code-coverage (1.2.18)
  - Installing phpunit/php-code-coverage (2.2.4)
    Downloading: 100%         

  - Removing phpunit/phpunit (3.7.37)
  - Installing phpunit/phpunit (4.8.21)
    Downloading: 100%         

sebastian/global-state suggests installing ext-uopz (*)
phpdocumentor/reflection-docblock suggests installing dflydev/markdown (~1.0)
phpdocumentor/reflection-docblock suggests installing erusev/parsedown (~1.0)
Writing lock file
Generating optimized autoload files
root@pwiki:/var/www/html/mediawiki/extensions/SemanticMediaWiki# php /var/www/html/mediawiki/composer.phar phpunit
> php ../../tests/phpunit/phpunit.php -c phpunit.xml.dist

Semantic MediaWiki: 2.3 (SMWSQLStore3, mysql)
MediaWiki:          1.25.3 (MediaWiki vendor autoloader)

PHP Notice:  Use of undefined constant CURLE_GOT_NOTHING - assumed 'CURLE_GOT_NOTHING' in /var/www/html/mediawiki-1.25.3/extensions/SemanticMediaWiki/tests/phpunit/Unit/SPARQLStore/BadHttpResponseMapperTest.php on line 112
PHP Notice:  Use of undefined constant CURLE_COULDNT_CONNECT - assumed 'CURLE_COULDNT_CONNECT' in /var/www/html/mediawiki-1.25.3/extensions/SemanticMediaWiki/tests/phpunit/Unit/SPARQLStore/BadHttpResponseMapperTest.php on line 113
PHPUnit 4.8.21 by Sebastian Bergmann and contributors.

Runtime:	PHP 5.5.9-1ubuntu4.14
Configuration:	/var/www/html/mediawiki-1.25.3/extensions/SemanticMediaWiki/phpunit.xml.dist

.............................................................   61 / 3234 (  1%)
.............................................................  122 / 3234 (  3%)
.............................................................  183 / 3234 (  5%)
.............................................................  244 / 3234 (  7%)
.............................................................  305 / 3234 (  9%)
.............................................................  366 / 3234 ( 11%)
.............................................................  427 / 3234 ( 13%)
.............................................................  488 / 3234 ( 15%)
.............................................................  549 / 3234 ( 16%)
.............................................................  610 / 3234 ( 18%)
.............................................................  671 / 3234 ( 20%)
.............................................................  732 / 3234 ( 22%)
.............................................................  793 / 3234 ( 24%)
.............................................................  854 / 3234 ( 26%)
.............................................................  915 / 3234 ( 28%)
.............................................................  976 / 3234 ( 30%)
............................................................. 1037 / 3234 ( 32%)
............................................................. 1098 / 3234 ( 33%)
............................................................. 1159 / 3234 ( 35%)
............................................................. 1220 / 3234 ( 37%)
............................................................. 1281 / 3234 ( 39%)
............................................................. 1342 / 3234 ( 41%)
............................................................. 1403 / 3234 ( 43%)
............................................................. 1464 / 3234 ( 45%)
............................................................. 1525 / 3234 ( 47%)
............................................................. 1586 / 3234 ( 49%)
............................................................. 1647 / 3234 ( 50%)
............................................................. 1708 / 3234 ( 52%)
............................................................. 1769 / 3234 ( 54%)
............................................................. 1830 / 3234 ( 56%)
............................................................. 1891 / 3234 ( 58%)
............................................................. 1952 / 3234 ( 60%)
............................................................. 2013 / 3234 ( 62%)
............................................................. 2074 / 3234 ( 64%)
..............EEEEEE......................................... 2135 / 3234 ( 66%)
............................................................. 2196 / 3234 ( 67%)
............................................................. 2257 / 3234 ( 69%)
............................EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE 2318 / 3234 ( 71%)
EEEEEEEEEEEEEEEEEEEEEEE.PHP Fatal error:  Call to undefined function SMW\SPARQLStore\curl_init() in /var/www/html/mediawiki-1.25.3/extensions/SemanticMediaWiki/src/SPARQLStore/RepositoryConnectionProvider.php on line 135
Script php ../../tests/phpunit/phpunit.php -c phpunit.xml.dist handling the phpunit event returned with an error


                                                                               
  [RuntimeException]                                                           
  Error Output: PHP Notice:  Use of undefined constant CURLE_GOT_NOTHING - as  
  sumed 'CURLE_GOT_NOTHING' in /var/www/html/mediawiki-1.25.3/extensions/Sema  
  nticMediaWiki/tests/phpunit/Unit/SPARQLStore/BadHttpResponseMapperTest.php   
  on line 112                                                                  
  PHP Notice:  Use of undefined constant CURLE_COULDNT_CONNECT - assumed 'CUR  
  LE_COULDNT_CONNECT' in /var/www/html/mediawiki-1.25.3/extensions/SemanticMe  
  diaWiki/tests/phpunit/Unit/SPARQLStore/BadHttpResponseMapperTest.php on lin  
  e 113                                                                        
  PHP Fatal error:  Call to undefined function SMW\SPARQLStore\curl_init() in  
   /var/www/html/mediawiki-1.25.3/extensions/SemanticMediaWiki/src/SPARQLStor  
  e/RepositoryConnectionProvider.php on line 135                               
                                                                               


phpunit [--dev] [--no-dev] [--] [<args>]...

after installing php5-curl

php /var/www/h
tml/mediawiki/composer.phar phpunit
> php ../../tests/phpunit/phpunit.php -c phpunit.xml.dist

Semantic MediaWiki: 2.3 (SMWSQLStore3, mysql)
MediaWiki:          1.25.3 (MediaWiki vendor autoloader)

PHPUnit 4.8.21 by Sebastian Bergmann and contributors.

Runtime:	PHP 5.5.9-1ubuntu4.14
Configuration:	/var/www/html/mediawiki-1.25.3/extensions/SemanticMediaWiki/phpunit.xml.dist

.............................................................   61 / 3234 (  1%)
.............................................................  122 / 3234 (  3%)
.............................................................  183 / 3234 (  5%)
.............................................................  244 / 3234 (  7%)
.............................................................  305 / 3234 (  9%)
.............................................................  366 / 3234 ( 11%)
.............................................................  427 / 3234 ( 13%)
.............................................................  488 / 3234 ( 15%)
.............................................................  549 / 3234 ( 16%)
.............................................................  610 / 3234 ( 18%)
.............................................................  671 / 3234 ( 20%)
.............................................................  732 / 3234 ( 22%)
.............................................................  793 / 3234 ( 24%)
.............................................................  854 / 3234 ( 26%)
.............................................................  915 / 3234 ( 28%)
.............................................................  976 / 3234 ( 30%)
............................................................. 1037 / 3234 ( 32%)
............................................................. 1098 / 3234 ( 33%)
............................................................. 1159 / 3234 ( 35%)
............................................................. 1220 / 3234 ( 37%)
............................................................. 1281 / 3234 ( 39%)
............................................................. 1342 / 3234 ( 41%)
............................................................. 1403 / 3234 ( 43%)
............................................................. 1464 / 3234 ( 45%)
............................................................. 1525 / 3234 ( 47%)
............................................................. 1586 / 3234 ( 49%)
............................................................. 1647 / 3234 ( 50%)
............................................................. 1708 / 3234 ( 52%)
............................................................. 1769 / 3234 ( 54%)
............................................................. 1830 / 3234 ( 56%)
............................................................. 1891 / 3234 ( 58%)
............................................................. 1952 / 3234 ( 60%)
............................................................. 2013 / 3234 ( 62%)
............................................................. 2074 / 3234 ( 64%)
............................................................. 2135 / 3234 ( 66%)
............................................................. 2196 / 3234 ( 67%)
............................................................. 2257 / 3234 ( 69%)
............................................................. 2318 / 3234 ( 71%)
............................................................. 2379 / 3234 ( 73%)
............................................................. 2440 / 3234 ( 75%)
............................................................. 2501 / 3234 ( 77%)
............................................................. 2562 / 3234 ( 79%)
............................................................. 2623 / 3234 ( 81%)
............................................................. 2684 / 3234 ( 82%)
............................................................. 2745 / 3234 ( 84%)
............................................................. 2806 / 3234 ( 86%)
......................................................SSSSSSS 2867 / 3234 ( 88%)
..............................................
SMW\Tests\Integration\MediaWiki\Import\Maintenance\RebuildDataMaintenanceTest testRebuildData ran for 18.337 seconds
............... 2928 / 3234 ( 90%)
............................................................. 2989 / 3234 ( 92%)
............................................................. 3050 / 3234 ( 94%)
............................................................. 3111 / 3234 ( 96%)
..........................................SSS................ 3172 / 3234 ( 98%)
............................................................. 3233 / 3234 ( 99%)
.

Time: 2.3 minutes, Memory: 226.25Mb

There were 10 skipped tests:

1) SMW\Tests\Integration\SPARQLStore\QueryResultLookupWithoutBaseStoreIntegrationTest::testQuerySubjects_afterUpdatingSemanticData
Requires a SPARQLStore instance

/var/www/html/mediawiki-1.25.3/extensions/SemanticMediaWiki/tests/phpunit/Integration/SPARQLStore/QueryResultLookupWithoutBaseStoreIntegrationTest.php:51

2) SMW\Tests\Integration\SPARQLStore\QueryResultLookupWithoutBaseStoreIntegrationTest::testQueryZeroResults_afterSubjectRemoval
Requires a SPARQLStore instance

/var/www/html/mediawiki-1.25.3/extensions/SemanticMediaWiki/tests/phpunit/Integration/SPARQLStore/QueryResultLookupWithoutBaseStoreIntegrationTest.php:51

3) SMW\Tests\Integration\SPARQLStore\QueryResultLookupWithoutBaseStoreIntegrationTest::testQuerySubjects_onNamspaceRestrictedCondition
Requires a SPARQLStore instance

/var/www/html/mediawiki-1.25.3/extensions/SemanticMediaWiki/tests/phpunit/Integration/SPARQLStore/QueryResultLookupWithoutBaseStoreIntegrationTest.php:51

4) SMW\Tests\Integration\SPARQLStore\QueryResultLookupWithoutBaseStoreIntegrationTest::testQuerySubobjects_afterUpdatingWithEmptyContainerAllAssociatedEntitiesGetRemovedFromGraph
Requires a SPARQLStore instance

/var/www/html/mediawiki-1.25.3/extensions/SemanticMediaWiki/tests/phpunit/Integration/SPARQLStore/QueryResultLookupWithoutBaseStoreIntegrationTest.php:51

5) SMW\Tests\Integration\SPARQLStore\RedirectLookupIntegrationTest::testRedirectTragetLookupForNonExistingEntry with data set #0 (SMW\Exporter\Element\ExpNsResource Object (...))
Requires a SPARQLStore instance

/var/www/html/mediawiki-1.25.3/extensions/SemanticMediaWiki/tests/phpunit/Integration/SPARQLStore/RedirectLookupIntegrationTest.php:38

6) SMW\Tests\Integration\SPARQLStore\RedirectLookupIntegrationTest::testRedirectTragetLookupForNonExistingEntry with data set #1 (SMW\Exporter\Element\ExpNsResource Object (...))
Requires a SPARQLStore instance

/var/www/html/mediawiki-1.25.3/extensions/SemanticMediaWiki/tests/phpunit/Integration/SPARQLStore/RedirectLookupIntegrationTest.php:38

7) SMW\Tests\Integration\SPARQLStore\RedirectLookupIntegrationTest::testRedirectTragetLookupForExistingEntry
Requires a SPARQLStore instance

/var/www/html/mediawiki-1.25.3/extensions/SemanticMediaWiki/tests/phpunit/Integration/SPARQLStore/RedirectLookupIntegrationTest.php:38

8) SMW\Tests\System\InstallationGlobalsProviderIntegrityTest::testNamespaceSettingOnExampleIfSet
Skip test due to missing http://example.org/id/ setting

/var/www/html/mediawiki-1.25.3/extensions/SemanticMediaWiki/tests/phpunit/Integration/System/InstallationConfigurationIntegrityTest.php:60

9) SMW\Tests\System\InstallationGlobalsProviderIntegrityTest::testNamespacesWithSemanticLinksOnTravisCustomNamespace with data set #0 ('GLOBALS', array(true, false, true, false, true, false, true, false, true, false, true, false, true, false, false, false, false, false, true, false, true, false))
Test can only be executed with a specified NS_TRAVIS

/var/www/html/mediawiki-1.25.3/extensions/SemanticMediaWiki/tests/phpunit/Integration/System/InstallationConfigurationIntegrityTest.php:75

10) SMW\Tests\System\InstallationGlobalsProviderIntegrityTest::testNamespacesWithSemanticLinksOnTravisCustomNamespace with data set #1 ('Settings', array(true, false, true, false, true, false, true, false, true, false, true, false, true, false, false, false, false, false, true, false, true, false))
Test can only be executed with a specified NS_TRAVIS

/var/www/html/mediawiki-1.25.3/extensions/SemanticMediaWiki/tests/phpunit/Integration/System/InstallationConfigurationIntegrityTest.php:75

OK, but incomplete, skipped, or risky tests!
Tests: 3234, Assertions: 9568, Skipped: 10.

Single Test

php /opt/local/apache2/htdocs/mediawiki/composer.phar phpunit tests/phpunit/Unit/OptionsTest.php 
> php ../../tests/phpunit/phpunit.php -c phpunit.xml.dist 'tests/phpunit/Unit/OptionsTest.php'

Semantic MediaWiki: 2.3 (SMWSQLStore3, mysql)
MediaWiki:          1.25.3 (MediaWiki vendor autoloader)

PHPUnit 4.8.21 by Sebastian Bergmann and contributors.

Runtime:	PHP 5.6.16
Configuration:	/opt/local/apache2/htdocs/mediawiki-1.25.3/extensions/SemanticMediaWiki/phpunit.xml.dist

...

Time: 266 ms, Memory: 16.25Mb

OK (3 tests, 4 assertions)

https://github.com/SemanticMediaWiki/SemanticMediaWiki

from github

neso:extensions wf$ git clone https://github.com/SemanticMediaWiki/SemanticMediaWiki
Cloning into 'SemanticMediaWiki'...
remote: Counting objects: 57123, done.
remote: Compressing objects: 100% (154/154), done.
remote: Total 57123 (delta 73), reused 0 (delta 0), pack-reused 56968
Receiving objects: 100% (57123/57123), 18.12 MiB | 5.01 MiB/s, done.
Resolving deltas: 100% (42918/42918), done.
Checking connectivity... done.

neso:SemanticMediaWiki wf$ git fetch origin pull/794/head
From https://github.com/SemanticMediaWiki/SemanticMediaWiki
 * branch            refs/pull/794/head -> FETCH_HEAD
neso:SemanticMediaWiki wf$ git checkout -b pullrequest FETCH_HEAD
Switched to a new branch 'pullrequest'

Parser Test

neso:SemanticMediaWiki wf$ php /opt/local/apache2/htdocs/mediawiki/composer.phar phpunit tests/phpunit/includes/parserhooks/SetParserFunctionTest.php 
> php ../../tests/phpunit/phpunit.php -c phpunit.xml.dist 'tests/phpunit/includes/parserhooks/SetParserFunctionTest.php'

Semantic MediaWiki: 2.4-alpha (SMWSQLStore3, mysql)
MediaWiki:          1.25.3 (MediaWiki vendor autoloader)

Execution date:     2015-12-27 06:37

PHPUnit 4.8.21 by Sebastian Bergmann and contributors.

Runtime:	PHP 5.6.16
Configuration:	/opt/local/apache2/htdocs/mediawiki-1.25.3/extensions/SemanticMediaWiki/phpunit.xml.dist

..........

Time: 288 ms, Memory: 24.25Mb

OK (10 tests, 35 assertions)
neso:SemanticMediaWiki wf$ php /opt/local/apache2/htdocs/mediawiki/composer.phar phpunit tests/phpunit/Unit/InTextAnnotationParserTest.php 
> php ../../tests/phpunit/phpunit.php -c phpunit.xml.dist 'tests/phpunit/Unit/InTextAnnotationParserTest.php'

Semantic MediaWiki: 2.4-alpha (SMWSQLStore3, mysql)
MediaWiki:          1.25.3 (MediaWiki vendor autoloader)

Execution date:     2015-12-27 06:38

PHPUnit 4.8.21 by Sebastian Bergmann and contributors.

Runtime:	PHP 5.6.16
Configuration:	/opt/local/apache2/htdocs/mediawiki-1.25.3/extensions/SemanticMediaWiki/phpunit.xml.dist

....................................

Time: 339 ms, Memory: 27.50Mb

OK (36 tests, 138 assertions)

Additional Test

/**
	 * test that <tag></tag> content can be parsed e.g. <pre>Some text</pre>
	 * @since 2.4
   * @author Wolfgang Fahl
	 */
	public function testTagParsing() {
		$params = array( 'Foo=sometext','Bar=<pre>Some text</pre>');
		$expected = array(
			'errors' => 0,
			'propertyCount'  => 2,
			'propertyLabels' => array( 'Foo','Bar' ),
			'propertyValues' => array( 'Sometext','<pre>Some text</pre>' )
		);
		$this->testInstantiatedPropertyValues($params,$expected);		
	}

SetParserFunction

see https://github.com/SemanticMediaWiki/SemanticMediaWiki/blob/master/includes/parserhooks/SetParserFunction.php

<?php

namespace SMW;

use SMW\MediaWiki\Renderer\WikitextTemplateRenderer;

use Parser;

/**
 * Class that provides the {{#set}} parser function
 *
 * @see http://semantic-mediawiki.org/wiki/Help:Properties_and_types#Silent_annotations_using_.23set
 * @see http://www.semantic-mediawiki.org/wiki/Help:Setting_values
 *
 * @license GNU GPL v2+
 * @since   1.9
 *
 * @author Markus Krötzsch
 * @author Jeroen De Dauw
 * @author mwjames
 */
class SetParserFunction {

	/**
	 * @var ParserData
	 */
	private $parserData;

	/**
	 * @var MessageFormatter
	 */
	private $messageFormatter;

	/**
	 * @var WikitextTemplateRenderer
	 */
	private $templateRenderer;

	/**
	 * @since 1.9
	 *
	 * @param ParserData $parserData
	 * @param MessageFormatter $messageFormatter
	 * @param WikitextTemplateRenderer $templateRenderer
	 */
	public function __construct( ParserData $parserData, MessageFormatter $messageFormatter, WikitextTemplateRenderer $templateRenderer ) {
		$this->parserData = $parserData;
		$this->messageFormatter = $messageFormatter;
		$this->templateRenderer = $templateRenderer;
	}

	/**
	 * @since  1.9
	 *
	 * @param ParserParameterProcessor $parameters
	 *
	 * @return string|null
	 */
	public function parse( ParserParameterProcessor $parameters ) {

		$count = 0;
		$template = '';
		$subject = $this->parserData->getSemanticData()->getSubject();

		$parametersToArray = $parameters->toArray();

		if ( isset( $parametersToArray['template'] ) ) {
			$template = $parametersToArray['template'][0];
			unset( $parametersToArray['template'] );
		}

		foreach ( $parametersToArray as $property => $values ) {

			$last = count( $values ) - 1; // -1 because the key starts with 0

			foreach ( $values as $key => $value ) {

				$dataValue = DataValueFactory::getInstance()->newPropertyValue(
						$property,
						$value,
						false,
						$subject
					);

				$this->parserData->addDataValue(
					$dataValue
				);

				$this->messageFormatter->addFromArray( $dataValue->getErrors() );

				$this->addFieldsToTemplate(
					$template,
					$dataValue,
					$property,
					$value,
					$last == $key,
					$count
				);
			}
		}

		$this->parserData->pushSemanticDataToParserOutput();

		$html = $this->templateRenderer->render() . $this->messageFormatter
			->addFromArray( $parameters->getErrors() )
			->getHtml();

		return array( $html, 'noparse' => $template === '', 'isHTML' => false );
	}

	private function addFieldsToTemplate( $template, $dataValue, $property, $value, $isLastElement, &$count ) {

		if ( $template === '' || !$dataValue->isValid() ) {
			return '';
		}

		$this->templateRenderer->addField( 'property', $property );
		$this->templateRenderer->addField( 'value', $value );
		$this->templateRenderer->addField( 'last-element', $isLastElement );
		$this->templateRenderer->addField( '#', $count++ );
		$this->templateRenderer->packFieldsForTemplate( $template );
	}

}

Ontology "IDE"