From cc8d10e8e9753b0354c2798bce90ca86f7f70d4b Mon Sep 17 00:00:00 2001 From: Osma Suominen Date: Tue, 18 Apr 2023 16:45:13 +0300 Subject: [PATCH] move model/view/controller under src/ and install php-cs-fixer style checker --- .github/workflows/ci.yml | 3 + .htaccess | 6 +- composer.json | 5 +- migrate-config.php | 153 ------------------ {controller => src/controller}/Controller.php | 0 .../controller}/EntityController.php | 0 {controller => src/controller}/Honeypot.php | 0 .../controller}/RestController.php | 0 .../controller}/WebController.php | 2 +- entity.php => src/entity.php | 2 +- index.php => src/index.php | 4 +- {model => src/model}/BaseConfig.php | 0 {model => src/model}/Breadcrumb.php | 0 {model => src/model}/Cache.php | 0 {model => src/model}/Concept.php | 0 .../model}/ConceptMappingPropertyValue.php | 0 {model => src/model}/ConceptProperty.php | 0 {model => src/model}/ConceptPropertyValue.php | 0 .../model}/ConceptPropertyValueLiteral.php | 0 .../model}/ConceptSearchParameters.php | 0 {model => src/model}/DataObject.php | 0 {model => src/model}/GlobalConfig.php | 4 +- {model => src/model}/LabelSkosXL.php | 0 {model => src/model}/Model.php | 0 {model => src/model}/Modifiable.php | 0 {model => src/model}/PluginRegister.php | 0 {model => src/model}/Request.php | 0 {model => src/model}/SkosmosTurtleParser.php | 0 {model => src/model}/Vocabulary.php | 0 {model => src/model}/VocabularyCategory.php | 0 {model => src/model}/VocabularyConfig.php | 0 {model => src/model}/VocabularyDataObject.php | 0 {model => src/model}/resolver/LOCResource.php | 0 .../model}/resolver/LinkedDataResource.php | 0 .../model}/resolver/RemoteResource.php | 0 {model => src/model}/resolver/Resolver.php | 0 .../model}/resolver/WDQSResource.php | 0 {model => src/model}/sparql/GenericSparql.php | 0 .../model}/sparql/JenaTextSparql.php | 0 rest.php => src/rest.php | 2 +- {view => src/view}/about.twig | 0 {view => src/view}/base-template.twig | 0 {view => src/view}/concept-card.inc | 0 {view => src/view}/concept.twig | 0 {view => src/view}/error.twig | 0 {view => src/view}/feedback.twig | 0 {view => src/view}/footer.inc | 0 {view => src/view}/global-search.twig | 0 {view => src/view}/header.inc | 0 {view => src/view}/landing.twig | 0 {view => src/view}/search-results.inc | 0 {view => src/view}/sidebar.inc | 0 {view => src/view}/vocab-home.twig | 0 {view => src/view}/vocab-info.inc | 0 {view => src/view}/vocab-search.twig | 0 tests/ConceptMappingPropertyValueTest.php | 2 +- tests/ConceptPropertyTest.php | 2 +- tests/ConceptPropertyValueLiteralTest.php | 2 +- tests/ConceptPropertyValueTest.php | 2 +- tests/ConceptSearchParametersTest.php | 54 +++---- tests/ConceptTest.php | 12 +- tests/FeedbackTest.php | 2 +- tests/GenericSparqlTest.php | 2 +- tests/GlobalConfigTest.php | 8 +- tests/Http304Test.php | 2 +- tests/JenaTextSparqlTest.php | 2 +- tests/ModelTest.php | 6 +- tests/PluginRegisterTest.php | 2 +- tests/RequestTest.php | 2 +- tests/ResolverTest.php | 2 +- tests/RestControllerTest.php | 7 +- tests/VocabularyCategoryTest.php | 2 +- tests/VocabularyConfigTest.php | 2 +- tests/VocabularyTest.php | 10 +- tests/WebControllerTest.php | 2 +- tests/bootstrap.php | 2 +- 76 files changed, 77 insertions(+), 231 deletions(-) delete mode 100644 migrate-config.php rename {controller => src/controller}/Controller.php (100%) rename {controller => src/controller}/EntityController.php (100%) rename {controller => src/controller}/Honeypot.php (100%) rename {controller => src/controller}/RestController.php (100%) rename {controller => src/controller}/WebController.php (99%) rename entity.php => src/entity.php (91%) rename index.php => src/index.php (98%) rename {model => src/model}/BaseConfig.php (100%) rename {model => src/model}/Breadcrumb.php (100%) rename {model => src/model}/Cache.php (100%) rename {model => src/model}/Concept.php (100%) rename {model => src/model}/ConceptMappingPropertyValue.php (100%) rename {model => src/model}/ConceptProperty.php (100%) rename {model => src/model}/ConceptPropertyValue.php (100%) rename {model => src/model}/ConceptPropertyValueLiteral.php (100%) rename {model => src/model}/ConceptSearchParameters.php (100%) rename {model => src/model}/DataObject.php (100%) rename {model => src/model}/GlobalConfig.php (98%) rename {model => src/model}/LabelSkosXL.php (100%) rename {model => src/model}/Model.php (100%) rename {model => src/model}/Modifiable.php (100%) rename {model => src/model}/PluginRegister.php (100%) rename {model => src/model}/Request.php (100%) rename {model => src/model}/SkosmosTurtleParser.php (100%) rename {model => src/model}/Vocabulary.php (100%) rename {model => src/model}/VocabularyCategory.php (100%) rename {model => src/model}/VocabularyConfig.php (100%) rename {model => src/model}/VocabularyDataObject.php (100%) rename {model => src/model}/resolver/LOCResource.php (100%) rename {model => src/model}/resolver/LinkedDataResource.php (100%) rename {model => src/model}/resolver/RemoteResource.php (100%) rename {model => src/model}/resolver/Resolver.php (100%) rename {model => src/model}/resolver/WDQSResource.php (100%) rename {model => src/model}/sparql/GenericSparql.php (100%) rename {model => src/model}/sparql/JenaTextSparql.php (100%) rename rest.php => src/rest.php (99%) rename {view => src/view}/about.twig (100%) rename {view => src/view}/base-template.twig (100%) rename {view => src/view}/concept-card.inc (100%) rename {view => src/view}/concept.twig (100%) rename {view => src/view}/error.twig (100%) rename {view => src/view}/feedback.twig (100%) rename {view => src/view}/footer.inc (100%) rename {view => src/view}/global-search.twig (100%) rename {view => src/view}/header.inc (100%) rename {view => src/view}/landing.twig (100%) rename {view => src/view}/search-results.inc (100%) rename {view => src/view}/sidebar.inc (100%) rename {view => src/view}/vocab-home.twig (100%) rename {view => src/view}/vocab-info.inc (100%) rename {view => src/view}/vocab-search.twig (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d6282bd89..f24385e81 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,6 +50,9 @@ jobs: php_version: ${{ matrix.php_version }} php_extensions: gettext intl xsl pcov + - name: Check PHP code style + run: ./vendor/bin/php-cs-fixer --diff --dry-run + - name: Run PHPUnit tests uses: php-actions/phpunit@v3 env: diff --git a/.htaccess b/.htaccess index 3773fb8b8..bc56b09a0 100644 --- a/.htaccess +++ b/.htaccess @@ -3,16 +3,16 @@ Options +FollowSymlinks -MultiViews -Indexes RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f -RewriteRule ^entity$ entity.php [L] +RewriteRule ^entity$ src/entity.php [L] RewriteRule ^rest/v1/swagger.json$ swagger.json [L] RewriteCond %{REQUEST_FILENAME} !-f -RewriteRule ^rest/v1/(.*)$ rest.php/$1 [L] +RewriteRule ^rest/v1/(.*)$ src/rest.php/$1 [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond $0 !^resource/ -RewriteRule ^(.*)$ index.php/$1 [L] +RewriteRule ^(.*)$ src/index.php/$1 [L] RewriteCond $0 ^favicon.ico$ RewriteCond custom-favicon.ico -F diff --git a/composer.json b/composer.json index 4e51f764c..751500c30 100644 --- a/composer.json +++ b/composer.json @@ -22,9 +22,10 @@ "require-dev": { "phpunit/phpunit": "9.5.*", "symfony/dom-crawler": "5.4.*", - "mockery/mockery": "1.5.1" + "mockery/mockery": "1.5.1", + "friendsofphp/php-cs-fixer": "3.16.*" }, "autoload": { - "classmap": ["controller/", "model/", "model/sparql/"] + "classmap": ["src/controller/", "src/model/", "src/model/sparql/"] } } diff --git a/migrate-config.php b/migrate-config.php deleted file mode 100644 index 4caa082d3..000000000 --- a/migrate-config.php +++ /dev/null @@ -1,153 +0,0 @@ - $prefixes, 'config' => $config]; -} - -// print usage if no args -if (!isset($argc) || $argc !== 3) { - throw new \Exception("Usage: php migrate-config config.inc vocabularies.ttl > config.ttl"); -} - -$configFile = $argv[1]; -$vocabulariesFile = $argv[2]; - -# parse the file into an array with the keys "prefixes" and "config" -$vocabs = parse_vocabularies_file($vocabulariesFile); - -# read the old style config file and use the constants to set variables for use in the template -if (!is_file($configFile)) { - throw new \Exception("Invalid configuration file: $configFile"); -} -include($configFile); -$endpoint = defined('DEFAULT_ENDPOINT') ? DEFAULT_ENDPOINT : "?"; -$dialect = defined('DEFAULT_SPARQL_DIALECT') ? DEFAULT_SPARQL_DIALECT : "?"; -$collationEnabled = defined('SPARQL_COLLATION_ENABLED') ? (SPARQL_COLLATION_ENABLED ? "true" : "false") : "?"; -$sparqlTimeout = defined('SPARQL_TIMEOUT') ? SPARQL_TIMEOUT : "?"; -$httpTimeout = defined('HTTP_TIMEOUT') ? HTTP_TIMEOUT : "?"; -$serviceName = defined('SERVICE_NAME') ? SERVICE_NAME : "?"; -$baseHref = defined('BASE_HREF') ? BASE_HREF : "?"; -$languages = ""; -if (isset($LANGUAGES) && !is_null($LANGUAGES) && is_array($LANGUAGES) && !empty($LANGUAGES)) { - foreach ($LANGUAGES as $code => $name) { - $languages .= " [ rdfs:label \"$code\" ; rdf:value \"$name\" ]\n"; - } -} -$searchResultsSize = defined('SEARCH_RESULTS_SIZE') ? SEARCH_RESULTS_SIZE : "?"; -$transitiveLimit = defined('DEFAULT_TRANSITIVE_LIMIT') ? DEFAULT_TRANSITIVE_LIMIT : "?"; -$logCaughtExceptions = defined('LOG_CAUGHT_EXCEPTIONS') ? (LOG_CAUGHT_EXCEPTIONS ? "true" : "false") : "?"; -$logBrowserConsole = defined('LOG_BROWSER_CONSOLE') ? (LOG_BROWSER_CONSOLE ? "true" : "false") : "?"; -$logFileName = defined('LOG_FILE_NAME') && !empty(LOG_FILE_NAME) ? LOG_FILE_NAME : "?"; -$templateCache = defined('TEMPLATE_CACHE') ? TEMPLATE_CACHE : "?"; -$customCss = defined('CUSTOM_CSS') ? CUSTOM_CSS : "?"; -$feedbackAddress = defined('FEEDBACK_ADDRESS') ? FEEDBACK_ADDRESS : "?"; -$feedbackSender = defined('FEEDBACK_SENDER') ? FEEDBACK_SENDER : "?"; -$feedbackEnvelopeSender = defined('FEEDBACK_ENVELOPE_SENDER') ? FEEDBACK_ENVELOPE_SENDER : "?"; -$uiLanguageDropdown = defined('UI_LANGUAGE_DROPDOWN') ? (UI_LANGUAGE_DROPDOWN ? "true" : "false") : "?"; -$uiHoneypotEnabled = defined('UI_HONEYPOT_ENABLED') ? (UI_HONEYPOT_ENABLED ? "true" : "false") : "?"; -$uiHoneypotTime = defined('UI_HONEYPOT_TIME') ? UI_HONEYPOT_TIME : "?"; -$globalPluginsArray = []; -$globalPlugins = ""; -if (defined('GLOBAL_PLUGINS') && !is_null(GLOBAL_PLUGINS) && is_string(GLOBAL_PLUGINS) && !empty(trim(GLOBAL_PLUGINS))) { - foreach (explode(' ', GLOBAL_PLUGINS) as $pluginName) { - $globalPluginsArray[] = "\"$pluginName\""; - } - $globalPlugins = " " . implode(', ', $globalPluginsArray) . " "; -} - -# print the prefixes -echo $vocabs['prefixes']; - -# print the global config using a string template -$globalConfig = << ; - # sparql-query extension, or "Generic" for plain SPARQL 1.1 - # set to "JenaText" instead if you use Fuseki with jena-text index - skosmos:sparqlDialect "$dialect" ; - # whether to enable collation in sparql queries - skosmos:sparqlCollationEnabled $collationEnabled ; - # HTTP client configuration - skosmos:sparqlTimeout $sparqlTimeout ; - skosmos:httpTimeout $httpTimeout ; - # customize the service name - skosmos:serviceName "$serviceName" ; - # customize the base element. Set this if the automatic base url detection doesn't work. For example setups behind a proxy. - skosmos:baseHref "$baseHref" ; - # interface languages available, and the corresponding system locales - skosmos:languages ( -$languages ) ; - # how many results (maximum) to load at a time on the search results page - skosmos:searchResultsSize $searchResultsSize ; - # how many items (maximum) to retrieve in transitive property queries - skosmos:transitiveLimit $transitiveLimit ; - # whether or not to log caught exceptions - skosmos:logCaughtExceptions $logCaughtExceptions ; - # set to TRUE to enable logging into browser console - skosmos:logBrowserConsole $logBrowserConsole ; - # set to a logfile path to enable logging into log file - skosmos:logFileName "$logFileName" ; - # a default location for Twig template rendering - skosmos:templateCache "$templateCache" ; - # customize the css by adding your own stylesheet - skosmos:customCss "$customCss" ; - # default email address where to send the feedback - skosmos:feedbackAddress "$feedbackAddress" ; - # email address to set as the sender for feedback messages - skosmos:feedbackSender "$feedbackSender" ; - # email address to set as the envelope sender for feedback messages - skosmos:feedbackEnvelopeSender "$feedbackEnvelopeSender" ; - # whether to display the ui language selection as a dropdown (useful for cases where there are more than 3 languages) - skosmos:uiLanguageDropdown $uiLanguageDropdown ; - # whether to enable the spam honey pot or not, enabled by default - skosmos:uiHoneypotEnabled $uiHoneypotEnabled ; - # default time a user must wait before submitting a form - skosmos:uiHoneypotTime $uiHoneypotTime ; - # plugins to activate for the whole installation (including all vocabularies) - skosmos:globalPlugins ($globalPlugins) . - -EOT; - -echo preg_replace('/(\\s*)(.*\\?[\\"]?[\s]*;.*)/', "\\1# \\2", $globalConfig); - -echo "\n# Skosmos vocabularies\n"; - -# print the vocabulary-specific configuration -echo $vocabs['config']; diff --git a/controller/Controller.php b/src/controller/Controller.php similarity index 100% rename from controller/Controller.php rename to src/controller/Controller.php diff --git a/controller/EntityController.php b/src/controller/EntityController.php similarity index 100% rename from controller/EntityController.php rename to src/controller/EntityController.php diff --git a/controller/Honeypot.php b/src/controller/Honeypot.php similarity index 100% rename from controller/Honeypot.php rename to src/controller/Honeypot.php diff --git a/controller/RestController.php b/src/controller/RestController.php similarity index 100% rename from controller/RestController.php rename to src/controller/RestController.php diff --git a/controller/WebController.php b/src/controller/WebController.php similarity index 99% rename from controller/WebController.php rename to src/controller/WebController.php index 9b8ebdc88..6603b2b5e 100644 --- a/controller/WebController.php +++ b/src/controller/WebController.php @@ -35,7 +35,7 @@ public function __construct($model) } // specify where to look for templates and cache - $loader = new Twig_Loader_Filesystem('view'); + $loader = new Twig_Loader_Filesystem('src/view'); // initialize Twig environment $this->twig = new Twig_Environment($loader, array('cache' => $tmpDir,'auto_reload' => true)); $this->twig->addExtension(new Twig_Extensions_Extension_I18n()); diff --git a/entity.php b/src/entity.php similarity index 91% rename from entity.php rename to src/entity.php index 3533b304b..535308f49 100644 --- a/entity.php +++ b/src/entity.php @@ -3,7 +3,7 @@ /** * Includes the side wide settings. */ -require_once 'vendor/autoload.php'; +require_once '../vendor/autoload.php'; header("Access-Control-Allow-Origin: *"); // enable CORS diff --git a/index.php b/src/index.php similarity index 98% rename from index.php rename to src/index.php index cae455f15..dd3a8c99e 100644 --- a/index.php +++ b/src/index.php @@ -4,10 +4,10 @@ * Use Composer autoloader to automatically load library classes. */ try { - if (!file_exists('./vendor/autoload.php')) { + if (!file_exists('../vendor/autoload.php')) { throw new Exception('Dependencies managed by Composer missing. Please run "php composer.phar install".'); } - require_once 'vendor/autoload.php'; + require_once '../vendor/autoload.php'; } catch (Exception $e) { echo "Error: " . $e->getMessage(); return; diff --git a/model/BaseConfig.php b/src/model/BaseConfig.php similarity index 100% rename from model/BaseConfig.php rename to src/model/BaseConfig.php diff --git a/model/Breadcrumb.php b/src/model/Breadcrumb.php similarity index 100% rename from model/Breadcrumb.php rename to src/model/Breadcrumb.php diff --git a/model/Cache.php b/src/model/Cache.php similarity index 100% rename from model/Cache.php rename to src/model/Cache.php diff --git a/model/Concept.php b/src/model/Concept.php similarity index 100% rename from model/Concept.php rename to src/model/Concept.php diff --git a/model/ConceptMappingPropertyValue.php b/src/model/ConceptMappingPropertyValue.php similarity index 100% rename from model/ConceptMappingPropertyValue.php rename to src/model/ConceptMappingPropertyValue.php diff --git a/model/ConceptProperty.php b/src/model/ConceptProperty.php similarity index 100% rename from model/ConceptProperty.php rename to src/model/ConceptProperty.php diff --git a/model/ConceptPropertyValue.php b/src/model/ConceptPropertyValue.php similarity index 100% rename from model/ConceptPropertyValue.php rename to src/model/ConceptPropertyValue.php diff --git a/model/ConceptPropertyValueLiteral.php b/src/model/ConceptPropertyValueLiteral.php similarity index 100% rename from model/ConceptPropertyValueLiteral.php rename to src/model/ConceptPropertyValueLiteral.php diff --git a/model/ConceptSearchParameters.php b/src/model/ConceptSearchParameters.php similarity index 100% rename from model/ConceptSearchParameters.php rename to src/model/ConceptSearchParameters.php diff --git a/model/DataObject.php b/src/model/DataObject.php similarity index 100% rename from model/DataObject.php rename to src/model/DataObject.php diff --git a/model/GlobalConfig.php b/src/model/GlobalConfig.php similarity index 98% rename from model/GlobalConfig.php rename to src/model/GlobalConfig.php index 7a1719262..0271ec31e 100644 --- a/model/GlobalConfig.php +++ b/src/model/GlobalConfig.php @@ -30,11 +30,11 @@ class GlobalConfig extends BaseConfig { */ private $configModifiedTime = null; - public function __construct($config_name='/../config.ttl') + public function __construct($config_name='../../config.ttl') { $this->cache = new Cache(); try { - $this->filePath = realpath( dirname(__FILE__) . $config_name ); + $this->filePath = realpath( dirname(__FILE__) . "/" . $config_name ); if (!file_exists($this->filePath)) { throw new Exception('config.ttl file is missing, please provide one.'); } diff --git a/model/LabelSkosXL.php b/src/model/LabelSkosXL.php similarity index 100% rename from model/LabelSkosXL.php rename to src/model/LabelSkosXL.php diff --git a/model/Model.php b/src/model/Model.php similarity index 100% rename from model/Model.php rename to src/model/Model.php diff --git a/model/Modifiable.php b/src/model/Modifiable.php similarity index 100% rename from model/Modifiable.php rename to src/model/Modifiable.php diff --git a/model/PluginRegister.php b/src/model/PluginRegister.php similarity index 100% rename from model/PluginRegister.php rename to src/model/PluginRegister.php diff --git a/model/Request.php b/src/model/Request.php similarity index 100% rename from model/Request.php rename to src/model/Request.php diff --git a/model/SkosmosTurtleParser.php b/src/model/SkosmosTurtleParser.php similarity index 100% rename from model/SkosmosTurtleParser.php rename to src/model/SkosmosTurtleParser.php diff --git a/model/Vocabulary.php b/src/model/Vocabulary.php similarity index 100% rename from model/Vocabulary.php rename to src/model/Vocabulary.php diff --git a/model/VocabularyCategory.php b/src/model/VocabularyCategory.php similarity index 100% rename from model/VocabularyCategory.php rename to src/model/VocabularyCategory.php diff --git a/model/VocabularyConfig.php b/src/model/VocabularyConfig.php similarity index 100% rename from model/VocabularyConfig.php rename to src/model/VocabularyConfig.php diff --git a/model/VocabularyDataObject.php b/src/model/VocabularyDataObject.php similarity index 100% rename from model/VocabularyDataObject.php rename to src/model/VocabularyDataObject.php diff --git a/model/resolver/LOCResource.php b/src/model/resolver/LOCResource.php similarity index 100% rename from model/resolver/LOCResource.php rename to src/model/resolver/LOCResource.php diff --git a/model/resolver/LinkedDataResource.php b/src/model/resolver/LinkedDataResource.php similarity index 100% rename from model/resolver/LinkedDataResource.php rename to src/model/resolver/LinkedDataResource.php diff --git a/model/resolver/RemoteResource.php b/src/model/resolver/RemoteResource.php similarity index 100% rename from model/resolver/RemoteResource.php rename to src/model/resolver/RemoteResource.php diff --git a/model/resolver/Resolver.php b/src/model/resolver/Resolver.php similarity index 100% rename from model/resolver/Resolver.php rename to src/model/resolver/Resolver.php diff --git a/model/resolver/WDQSResource.php b/src/model/resolver/WDQSResource.php similarity index 100% rename from model/resolver/WDQSResource.php rename to src/model/resolver/WDQSResource.php diff --git a/model/sparql/GenericSparql.php b/src/model/sparql/GenericSparql.php similarity index 100% rename from model/sparql/GenericSparql.php rename to src/model/sparql/GenericSparql.php diff --git a/model/sparql/JenaTextSparql.php b/src/model/sparql/JenaTextSparql.php similarity index 100% rename from model/sparql/JenaTextSparql.php rename to src/model/sparql/JenaTextSparql.php diff --git a/rest.php b/src/rest.php similarity index 99% rename from rest.php rename to src/rest.php index 107801829..e6c60b2d3 100644 --- a/rest.php +++ b/src/rest.php @@ -3,7 +3,7 @@ /** * Includes the side wide settings. */ -require_once 'vendor/autoload.php'; +require_once '../vendor/autoload.php'; header("Access-Control-Allow-Origin: *"); // enable CORS for the whole REST API diff --git a/view/about.twig b/src/view/about.twig similarity index 100% rename from view/about.twig rename to src/view/about.twig diff --git a/view/base-template.twig b/src/view/base-template.twig similarity index 100% rename from view/base-template.twig rename to src/view/base-template.twig diff --git a/view/concept-card.inc b/src/view/concept-card.inc similarity index 100% rename from view/concept-card.inc rename to src/view/concept-card.inc diff --git a/view/concept.twig b/src/view/concept.twig similarity index 100% rename from view/concept.twig rename to src/view/concept.twig diff --git a/view/error.twig b/src/view/error.twig similarity index 100% rename from view/error.twig rename to src/view/error.twig diff --git a/view/feedback.twig b/src/view/feedback.twig similarity index 100% rename from view/feedback.twig rename to src/view/feedback.twig diff --git a/view/footer.inc b/src/view/footer.inc similarity index 100% rename from view/footer.inc rename to src/view/footer.inc diff --git a/view/global-search.twig b/src/view/global-search.twig similarity index 100% rename from view/global-search.twig rename to src/view/global-search.twig diff --git a/view/header.inc b/src/view/header.inc similarity index 100% rename from view/header.inc rename to src/view/header.inc diff --git a/view/landing.twig b/src/view/landing.twig similarity index 100% rename from view/landing.twig rename to src/view/landing.twig diff --git a/view/search-results.inc b/src/view/search-results.inc similarity index 100% rename from view/search-results.inc rename to src/view/search-results.inc diff --git a/view/sidebar.inc b/src/view/sidebar.inc similarity index 100% rename from view/sidebar.inc rename to src/view/sidebar.inc diff --git a/view/vocab-home.twig b/src/view/vocab-home.twig similarity index 100% rename from view/vocab-home.twig rename to src/view/vocab-home.twig diff --git a/view/vocab-info.inc b/src/view/vocab-info.inc similarity index 100% rename from view/vocab-info.inc rename to src/view/vocab-info.inc diff --git a/view/vocab-search.twig b/src/view/vocab-search.twig similarity index 100% rename from view/vocab-search.twig rename to src/view/vocab-search.twig diff --git a/tests/ConceptMappingPropertyValueTest.php b/tests/ConceptMappingPropertyValueTest.php index 11377191e..1c918d61c 100644 --- a/tests/ConceptMappingPropertyValueTest.php +++ b/tests/ConceptMappingPropertyValueTest.php @@ -16,7 +16,7 @@ protected function setUp() : void bind_textdomain_codeset('skosmos', 'UTF-8'); textdomain('skosmos'); - $this->model = new Model(new GlobalConfig('/../tests/testconfig.ttl')); + $this->model = new Model(new GlobalConfig('/../../tests/testconfig.ttl')); $this->vocab = $this->model->getVocabulary('mapping'); $concepts = $this->vocab->getConceptInfo('http://www.skosmos.skos/mapping/m1', 'en'); $this->concept = $concepts[0]; diff --git a/tests/ConceptPropertyTest.php b/tests/ConceptPropertyTest.php index 85e6c0f49..920d566d2 100644 --- a/tests/ConceptPropertyTest.php +++ b/tests/ConceptPropertyTest.php @@ -13,7 +13,7 @@ protected function setUp() : void bind_textdomain_codeset('skosmos', 'UTF-8'); textdomain('skosmos'); - $this->model = new Model(new GlobalConfig('/../tests/testconfig.ttl')); + $this->model = new Model(new GlobalConfig('/../../tests/testconfig.ttl')); } /** diff --git a/tests/ConceptPropertyValueLiteralTest.php b/tests/ConceptPropertyValueLiteralTest.php index 72eb76991..61fc8da05 100644 --- a/tests/ConceptPropertyValueLiteralTest.php +++ b/tests/ConceptPropertyValueLiteralTest.php @@ -15,7 +15,7 @@ protected function setUp() : void bind_textdomain_codeset('skosmos', 'UTF-8'); textdomain('skosmos'); - $this->model = new Model(new GlobalConfig('/../tests/testconfig.ttl')); + $this->model = new Model(new GlobalConfig('/../../tests/testconfig.ttl')); $this->vocab = $this->model->getVocabulary('test'); $results = $this->vocab->getConceptInfo('http://www.skosmos.skos/test/ta112', 'en'); $this->concept = reset($results); diff --git a/tests/ConceptPropertyValueTest.php b/tests/ConceptPropertyValueTest.php index 61cdbd0dd..67c98c5bb 100644 --- a/tests/ConceptPropertyValueTest.php +++ b/tests/ConceptPropertyValueTest.php @@ -15,7 +15,7 @@ protected function setUp() : void bind_textdomain_codeset('skosmos', 'UTF-8'); textdomain('skosmos'); - $this->model = new Model(new GlobalConfig('/../tests/testconfig.ttl')); + $this->model = new Model(new GlobalConfig('/../../tests/testconfig.ttl')); $this->vocab = $this->model->getVocabulary('test'); $results = $this->vocab->getConceptInfo('http://www.skosmos.skos/test/ta112', 'en'); $this->concept = reset($results); diff --git a/tests/ConceptSearchParametersTest.php b/tests/ConceptSearchParametersTest.php index 93bf7e555..17f3ed2a5 100644 --- a/tests/ConceptSearchParametersTest.php +++ b/tests/ConceptSearchParametersTest.php @@ -11,7 +11,7 @@ protected function setUp() : void putenv("LC_ALL=en_GB.utf8"); setlocale(LC_ALL, 'en_GB.utf8'); $this->request = $this->getMockBuilder('Request')->disableOriginalConstructor()->getMock(); - $this->model = new Model(new GlobalConfig('/../tests/testconfig.ttl')); + $this->model = new Model(new GlobalConfig('/../../tests/testconfig.ttl')); } protected function tearDown() : void @@ -24,7 +24,7 @@ protected function tearDown() : void * @covers ConceptSearchParameters::getSearchLimit */ public function testConstructorAndSearchLimit() { - $params = new ConceptSearchParameters($this->request, new GlobalConfig('/../tests/testconfig.ttl'), true); + $params = new ConceptSearchParameters($this->request, new GlobalConfig('/../../tests/testconfig.ttl'), true); $this->assertEquals(0, $params->getSearchLimit()); } @@ -33,7 +33,7 @@ public function testConstructorAndSearchLimit() { */ public function testGetLang() { $this->request->method('getLang')->will($this->returnValue('en')); - $params = new ConceptSearchParameters($this->request, new GlobalConfig('/../tests/testconfig.ttl'), true); + $params = new ConceptSearchParameters($this->request, new GlobalConfig('/../../tests/testconfig.ttl'), true); $this->assertEquals('en', $params->getLang()); $this->request->method('getQueryParam')->will($this->returnValue('sv')); $this->assertEquals('sv', $params->getLang()); @@ -44,7 +44,7 @@ public function testGetLang() { * @covers ConceptSearchParameters::setVocabularies */ public function testGetVocabs() { - $params = new ConceptSearchParameters($this->request, new GlobalConfig('/../tests/testconfig.ttl')); + $params = new ConceptSearchParameters($this->request, new GlobalConfig('/../../tests/testconfig.ttl')); $this->assertEquals(array(), $params->getVocabs()); $this->request->method('getVocab')->will($this->returnValue('vocfromrequest')); $this->assertEquals(array('vocfromrequest'), $params->getVocabs()); @@ -56,11 +56,11 @@ public function testGetVocabs() { * @covers ConceptSearchParameters::getVocabids */ public function testGetVocabids() { - $params = new ConceptSearchParameters($this->request, new GlobalConfig('/../tests/testconfig.ttl')); + $params = new ConceptSearchParameters($this->request, new GlobalConfig('/../../tests/testconfig.ttl')); $this->assertEquals(null, $params->getVocabids()); $params->setVocabularies(array($this->model->getVocabulary('test'))); $this->assertEquals(array('test'), $params->getVocabids()); - $params = new ConceptSearchParameters($this->request, new GlobalConfig('/../tests/testconfig.ttl'), true); + $params = new ConceptSearchParameters($this->request, new GlobalConfig('/../../tests/testconfig.ttl'), true); $this->assertEquals(null, $params->getVocabids()); $mockreq = $this->getMockBuilder('Request')->disableOriginalConstructor()->getMock(); $qparams = array( @@ -68,9 +68,9 @@ public function testGetVocabids() { array('vocabs', 'test dates') ); $mockreq->method('getQueryParam')->will($this->returnValueMap($qparams)); - $params = new ConceptSearchParameters($mockreq, new GlobalConfig('/../tests/testconfig.ttl')); + $params = new ConceptSearchParameters($mockreq, new GlobalConfig('/../../tests/testconfig.ttl')); $this->assertEquals(array('test', 'dates'), $params->getVocabids()); - $params = new ConceptSearchParameters($mockreq, new GlobalConfig('/../tests/testconfig.ttl'), true); + $params = new ConceptSearchParameters($mockreq, new GlobalConfig('/../../tests/testconfig.ttl'), true); $this->assertEquals(array('test'), $params->getVocabids()); } @@ -78,11 +78,11 @@ public function testGetVocabids() { * @covers ConceptSearchParameters::getSearchTerm */ public function testGetSearchTerm() { - $params = new ConceptSearchParameters($this->request, new GlobalConfig('/../tests/testconfig.ttl')); + $params = new ConceptSearchParameters($this->request, new GlobalConfig('/../../tests/testconfig.ttl')); $this->assertEquals('*', $params->getSearchTerm()); $this->request->method('getQueryParamRaw')->will($this->returnValue('test')); $this->assertEquals('test*', $params->getSearchTerm()); - $params = new ConceptSearchParameters($this->request, new GlobalConfig('/../tests/testconfig.ttl'), true); + $params = new ConceptSearchParameters($this->request, new GlobalConfig('/../../tests/testconfig.ttl'), true); $this->assertEquals('test', $params->getSearchTerm()); } @@ -91,7 +91,7 @@ public function testGetSearchTerm() { * Is created particularly for searches not using REST */ public function testSearchTermWithoutRest() { - $params = new ConceptSearchParameters($this->request, new GlobalConfig('/../tests/testconfig.ttl'), false); + $params = new ConceptSearchParameters($this->request, new GlobalConfig('/../../tests/testconfig.ttl'), false); $this->request->method('getQueryParamRaw')->will($this->returnValue('0')); $this->assertEquals('0*', $params->getSearchTerm()); } @@ -104,7 +104,7 @@ public function testSearchTermWithoutRest() { * @covers ConceptSearchParameters::getSearchTerm */ public function testGetSearchTermZeroes() { - $params = new ConceptSearchParameters($this->request, new GlobalConfig('/../tests/testconfig.ttl'), true); + $params = new ConceptSearchParameters($this->request, new GlobalConfig('/../../tests/testconfig.ttl'), true); $this->assertEquals('', $params->getSearchTerm()); $this->request->method('getQueryParamRaw')->will( $this->returnValueMap([ @@ -123,7 +123,7 @@ public function testGetSearchTermZeroes() { public function testGetTypeLimitNoQueryParam() { $mockreq = $this->getMockBuilder('Request')->disableOriginalConstructor()->getMock(); $mockreq->method('getVocab')->will($this->returnValue($this->model->getVocabulary('test'))); - $params = new ConceptSearchParameters($mockreq, new GlobalConfig('/../tests/testconfig.ttl')); + $params = new ConceptSearchParameters($mockreq, new GlobalConfig('/../../tests/testconfig.ttl')); $this->assertEquals(array('skos:Concept', 'http://purl.org/iso25964/skos-thes#ThesaurusArray', 'http://www.w3.org/2004/02/skos/core#Collection'), $params->getTypeLimit()); } @@ -132,7 +132,7 @@ public function testGetTypeLimitNoQueryParam() { * @covers ConceptSearchParameters::getDefaultTypeLimit */ public function testGetTypeLimit() { - $params = new ConceptSearchParameters($this->request, new GlobalConfig('/../tests/testconfig.ttl')); + $params = new ConceptSearchParameters($this->request, new GlobalConfig('/../../tests/testconfig.ttl')); $this->assertEquals(array('skos:Concept'), $params->getTypeLimit()); $this->request->method('getQueryParam')->will($this->returnValue('isothes:ThesaurusArray+skos:Collection')); $this->assertEquals(array('isothes:ThesaurusArray', 'skos:Collection'), $params->getTypeLimit()); @@ -143,7 +143,7 @@ public function testGetTypeLimit() { * @covers ConceptSearchParameters::getDefaultTypeLimit */ public function testGetTypeLimitOnlyOne() { - $params = new ConceptSearchParameters($this->request, new GlobalConfig('/../tests/testconfig.ttl')); + $params = new ConceptSearchParameters($this->request, new GlobalConfig('/../../tests/testconfig.ttl')); $this->request->method('getQueryParam')->will($this->returnValue('skos:Collection')); $this->assertEquals(array('skos:Collection'), $params->getTypeLimit()); } @@ -153,7 +153,7 @@ public function testGetTypeLimitOnlyOne() { * @covers ConceptSearchParameters::setUnique */ public function testGetAndSetUnique() { - $params = new ConceptSearchParameters($this->request, new GlobalConfig('/../tests/testconfig.ttl')); + $params = new ConceptSearchParameters($this->request, new GlobalConfig('/../../tests/testconfig.ttl')); $this->assertEquals(false, $params->getUnique()); $params->setUnique(true); $this->assertEquals(true, $params->getUnique()); @@ -164,7 +164,7 @@ public function testGetAndSetUnique() { * @covers ConceptSearchParameters::setHidden */ public function testGetAndSetHidden() { - $params = new ConceptSearchParameters($this->request, new GlobalConfig('/../tests/testconfig.ttl')); + $params = new ConceptSearchParameters($this->request, new GlobalConfig('/../../tests/testconfig.ttl')); $this->assertEquals(true, $params->getHidden()); $params->setHidden(false); $this->assertEquals(false, $params->getHidden()); @@ -174,7 +174,7 @@ public function testGetAndSetHidden() { * @covers ConceptSearchParameters::getArrayClass */ public function testGetArrayClassWithoutVocabulary() { - $params = new ConceptSearchParameters($this->request, new GlobalConfig('/../tests/testconfig.ttl')); + $params = new ConceptSearchParameters($this->request, new GlobalConfig('/../../tests/testconfig.ttl')); $this->assertEquals(null, $params->getArrayClass()); } @@ -182,7 +182,7 @@ public function testGetArrayClassWithoutVocabulary() { * @covers ConceptSearchParameters::getArrayClass */ public function testGetArrayClass() { - $params = new ConceptSearchParameters($this->request, new GlobalConfig('/../tests/testconfig.ttl')); + $params = new ConceptSearchParameters($this->request, new GlobalConfig('/../../tests/testconfig.ttl')); $params->setVocabularies(array($this->model->getVocabulary('test'))); $this->assertEquals('http://purl.org/iso25964/skos-thes#ThesaurusArray', $params->getArrayClass()); } @@ -192,7 +192,7 @@ public function testGetArrayClass() { * @covers ConceptSearchParameters::getQueryParam */ public function testGetSchemeLimit() { - $params = new ConceptSearchParameters($this->request, new GlobalConfig('/../tests/testconfig.ttl')); + $params = new ConceptSearchParameters($this->request, new GlobalConfig('/../../tests/testconfig.ttl')); $this->assertEquals([], $params->getSchemeLimit()); $this->request->method('getQueryParam')->will($this->returnValue('http://www.skosmos.skos/test/ http://www.skosmos.skos/date/')); $this->assertEquals(array(0 => 'http://www.skosmos.skos/test/', 1 => 'http://www.skosmos.skos/date/'), $params->getSchemeLimit()); @@ -203,7 +203,7 @@ public function testGetSchemeLimit() { */ public function testGetContentLang() { $this->request->method('getContentLang')->will($this->returnValue('de')); - $params = new ConceptSearchParameters($this->request, new GlobalConfig('/../tests/testconfig.ttl')); + $params = new ConceptSearchParameters($this->request, new GlobalConfig('/../../tests/testconfig.ttl')); $this->assertEquals('de', $params->getContentLang()); } @@ -211,9 +211,9 @@ public function testGetContentLang() { * @covers ConceptSearchParameters::getSearchLang */ public function testGetSearchLang() { - $params = new ConceptSearchParameters($this->request, new GlobalConfig('/../tests/testconfig.ttl')); + $params = new ConceptSearchParameters($this->request, new GlobalConfig('/../../tests/testconfig.ttl')); $this->assertEquals(null, $params->getSearchLang()); - $params = new ConceptSearchParameters($this->request, new GlobalConfig('/../tests/testconfig.ttl')); + $params = new ConceptSearchParameters($this->request, new GlobalConfig('/../../tests/testconfig.ttl')); $this->request->method('getContentLang')->will($this->returnValue('en')); $this->request->method('getQueryParam')->will($this->returnValue('on')); //anylang=on $this->assertEquals('', $params->getSearchLang()); @@ -224,7 +224,7 @@ public function testGetSearchLang() { */ public function testGetOffsetNonNumeric() { $this->request->method('getQueryParam')->will($this->returnValue('notvalid')); - $params = new ConceptSearchParameters($this->request, new GlobalConfig('/../tests/testconfig.ttl')); + $params = new ConceptSearchParameters($this->request, new GlobalConfig('/../../tests/testconfig.ttl')); $this->assertEquals(0, $params->getOffset()); } @@ -233,7 +233,7 @@ public function testGetOffsetNonNumeric() { */ public function testGetOffsetValid() { $this->request->method('getQueryParam')->will($this->returnValue(25)); - $params = new ConceptSearchParameters($this->request, new GlobalConfig('/../tests/testconfig.ttl')); + $params = new ConceptSearchParameters($this->request, new GlobalConfig('/../../tests/testconfig.ttl')); $this->assertEquals(25, $params->getOffset()); } @@ -245,7 +245,7 @@ public function testGetAdditionalField() { array('fields', 'broader') ); $this->request->method('getQueryParam')->will($this->returnValueMap($map)); - $params = new ConceptSearchParameters($this->request, new GlobalConfig('/../tests/testconfig.ttl')); + $params = new ConceptSearchParameters($this->request, new GlobalConfig('/../../tests/testconfig.ttl')); $this->assertEquals(array('broader'), $params->getAdditionalFields()); } @@ -257,7 +257,7 @@ public function testGetAdditionalFields() { array('fields', 'broader prefLabel') ); $this->request->method('getQueryParam')->will($this->returnValueMap($map)); - $params = new ConceptSearchParameters($this->request, new GlobalConfig('/../tests/testconfig.ttl')); + $params = new ConceptSearchParameters($this->request, new GlobalConfig('/../../tests/testconfig.ttl')); $this->assertEquals(array('broader', 'prefLabel'), $params->getAdditionalFields()); } diff --git a/tests/ConceptTest.php b/tests/ConceptTest.php index 305f405fc..c97c98323 100644 --- a/tests/ConceptTest.php +++ b/tests/ConceptTest.php @@ -19,7 +19,7 @@ protected function setUp() : void bind_textdomain_codeset('skosmos', 'UTF-8'); textdomain('skosmos'); - $this->model = new Model(new GlobalConfig('/../tests/testconfig.ttl')); + $this->model = new Model(new GlobalConfig('/../../tests/testconfig.ttl')); $this->vocab = $this->model->getVocabulary('test'); $results = $this->vocab->getConceptInfo('http://www.skosmos.skos/test/ta112', 'en'); $this->concept = reset($results); @@ -373,7 +373,7 @@ public function testGetLabelCurrentLanguage() */ public function testGetLabelWhenNull() { - $model = new Model(new GlobalConfig('/../tests/testconfig.ttl')); + $model = new Model(new GlobalConfig('/../../tests/testconfig.ttl')); $vocab = $model->getVocabulary('test'); $concept = $vocab->getConceptInfo("http://www.skosmos.skos/test/ta120", "en"); $this->assertEquals(null, $concept[0]->getLabel()); @@ -398,7 +398,7 @@ public function testGetLabelResortingToVocabDefault() */ public function testGetGroupProperties() { - $model = new Model(new GlobalConfig('/../tests/testconfig.ttl')); + $model = new Model(new GlobalConfig('/../../tests/testconfig.ttl')); $vocab = $model->getVocabulary('groups'); $concept = $vocab->getConceptInfo("http://www.skosmos.skos/groups/ta111", "en"); $arrays = $concept[0]->getArrayProperties(); @@ -414,7 +414,7 @@ public function testGetGroupProperties() */ public function testGetGroupPropertiesWithDuplicatedInformationFilteredOut() { - $model = new Model(new GlobalConfig('/../tests/testconfig.ttl')); + $model = new Model(new GlobalConfig('/../../tests/testconfig.ttl')); $vocab = $model->getVocabulary('dupgroup'); $concept = $vocab->getConceptInfo("http://www.skosmos.skos/dupgroup/c1", "en"); $groups = $concept[0]->getGroupProperties(); @@ -427,7 +427,7 @@ public function testGetGroupPropertiesWithDuplicatedInformationFilteredOut() */ public function testGetGroupPropertiesWithHierarchy() { - $model = new Model(new GlobalConfig('/../tests/testconfig.ttl')); + $model = new Model(new GlobalConfig('/../../tests/testconfig.ttl')); $vocab = $model->getVocabulary('dupgroup'); $concept = $vocab->getConceptInfo("http://www.skosmos.skos/dupgroup/ta111", "en"); $groups = $concept[0]->getGroupProperties(); @@ -445,7 +445,7 @@ public function testGetGroupPropertiesWithHierarchy() */ public function testGetPropertiesWithNarrowersPartOfACollection() { - $model = new Model(new GlobalConfig('/../tests/testconfig.ttl')); + $model = new Model(new GlobalConfig('/../../tests/testconfig.ttl')); $vocab = $model->getVocabulary('groups'); $concept = $vocab->getConceptInfo("http://www.skosmos.skos/groups/ta1", "en"); $props = $concept[0]->getProperties(); diff --git a/tests/FeedbackTest.php b/tests/FeedbackTest.php index bf4a5d5f6..fe164e378 100644 --- a/tests/FeedbackTest.php +++ b/tests/FeedbackTest.php @@ -9,7 +9,7 @@ class FeedbackTest extends PHPUnit\Framework\TestCase protected function setUp() : void { - $config = new GlobalConfig('/../tests/testconfig-fordefaults.ttl'); + $config = new GlobalConfig('/../../tests/testconfig-fordefaults.ttl'); $this->model = new Model($config); $this->request = \Mockery::mock('Request', array($this->model))->makePartial(); $this->request->setLang('en'); diff --git a/tests/GenericSparqlTest.php b/tests/GenericSparqlTest.php index dae9b5881..7fa663ef1 100644 --- a/tests/GenericSparqlTest.php +++ b/tests/GenericSparqlTest.php @@ -13,7 +13,7 @@ protected function setUp() : void putenv("LANGUAGE=en_GB.utf8"); putenv("LC_ALL=en_GB.utf8"); setlocale(LC_ALL, 'en_GB.utf8'); - $this->model = new Model(new GlobalConfig('/../tests/testconfig.ttl')); + $this->model = new Model(new GlobalConfig('/../../tests/testconfig.ttl')); $this->vocab = $this->model->getVocabulary('test'); $this->graph = $this->vocab->getGraph(); $this->params = $this->getMockBuilder('ConceptSearchParameters')->disableOriginalConstructor()->getMock(); diff --git a/tests/GlobalConfigTest.php b/tests/GlobalConfigTest.php index 7715a3952..e9d42d780 100644 --- a/tests/GlobalConfigTest.php +++ b/tests/GlobalConfigTest.php @@ -13,10 +13,10 @@ class GlobalConfigTest extends PHPUnit\Framework\TestCase protected function setUp() : void { - $this->config = new GlobalConfig('/../tests/testconfig.ttl'); + $this->config = new GlobalConfig('/../../tests/testconfig.ttl'); $this->assertNotNull($this->config->getCache()); $this->assertNotNull($this->config->getGraph()); - $this->configWithDefaults = new GlobalConfig('/../tests/testconfig-fordefaults.ttl'); + $this->configWithDefaults = new GlobalConfig('/../../tests/testconfig-fordefaults.ttl'); } // --- tests for values that are overriding default values @@ -136,14 +136,14 @@ public function testGetGlobalPlugins() public function testInitializeConfigWithoutGraph() { $this->expectOutputString('Error: config.ttl must have exactly one skosmos:Configuration'); - $conf = new GlobalConfig('/../tests/testconfig-nograph.ttl'); + $conf = new GlobalConfig('/../../tests/testconfig-nograph.ttl'); $this->assertNotNull($conf); } public function testInexistentFile() { $this->expectOutputString('Error: config.ttl file is missing, please provide one.'); - $conf = new GlobalConfig('/../tests/testconfig-idonotexist.ttl'); + $conf = new GlobalConfig('/../../tests/testconfig-idonotexist.ttl'); $this->assertNotNull($conf); } diff --git a/tests/Http304Test.php b/tests/Http304Test.php index cbeafe1b0..cbff38ccb 100644 --- a/tests/Http304Test.php +++ b/tests/Http304Test.php @@ -40,7 +40,7 @@ public function initObjects(string $vocabularyName) bindtextdomain('skosmos', 'resource/translations'); bind_textdomain_codeset('skosmos', 'UTF-8'); textdomain('skosmos'); - $this->model = Mockery::mock(new Model(new GlobalConfig('/../tests/testconfig.ttl')))->makePartial(); + $this->model = Mockery::mock(new Model(new GlobalConfig('/../../tests/testconfig.ttl')))->makePartial(); $this->vocab = Mockery::mock($this->model->getVocabulary($vocabularyName))->makePartial(); $this->controller = Mockery::mock('WebController') ->shouldAllowMockingProtectedMethods() diff --git a/tests/JenaTextSparqlTest.php b/tests/JenaTextSparqlTest.php index 821303f38..280efeca9 100644 --- a/tests/JenaTextSparqlTest.php +++ b/tests/JenaTextSparqlTest.php @@ -13,7 +13,7 @@ protected function setUp() : void putenv("LANGUAGE=en_GB.utf8"); putenv("LC_ALL=en_GB.utf8"); setlocale(LC_ALL, 'en_GB.utf8'); - $this->model = new Model(new GlobalConfig('/../tests/jenatestconfig.ttl')); + $this->model = new Model(new GlobalConfig('/../../tests/jenatestconfig.ttl')); $this->vocab = $this->model->getVocabulary('test'); $this->graph = $this->vocab->getGraph(); $this->params = $this->getMockBuilder('ConceptSearchParameters')->disableOriginalConstructor()->getMock(); diff --git a/tests/ModelTest.php b/tests/ModelTest.php index ce8fa4f32..07d769ee7 100644 --- a/tests/ModelTest.php +++ b/tests/ModelTest.php @@ -10,7 +10,7 @@ protected function setUp() : void putenv("LANGUAGE=en_GB.utf8"); putenv("LC_ALL=en_GB.utf8"); setlocale(LC_ALL, 'en_GB.utf8'); - $this->model = new Model(new GlobalConfig('/../tests/testconfig.ttl')); + $this->model = new Model(new GlobalConfig('/../../tests/testconfig.ttl')); $this->params = $this->getMockBuilder('ConceptSearchParameters')->disableOriginalConstructor()->getMock(); $this->params->method('getVocabIds')->will($this->returnValue(array('test'))); $this->params->method('getVocabs')->will($this->returnValue(array($this->model->getVocabulary('test')))); @@ -26,7 +26,7 @@ protected function tearDown() : void */ public function testConstructorWithConfig() { - $model = new Model(new GlobalConfig('/../tests/testconfig.ttl')); + $model = new Model(new GlobalConfig('/../../tests/testconfig.ttl')); $this->assertNotNull($model); } @@ -512,7 +512,7 @@ public function testGetRDFShouldIncludeLists() { * Issue: https://github.com/NatLibFi/Skosmos/pull/419 */ public function testGetRDFShouldNotIncludeExtraBlankNodesFromLists() { - $model = new Model(new GlobalConfig('/../tests/testconfig.ttl')); + $model = new Model(new GlobalConfig('/../../tests/testconfig.ttl')); $result = $model->getRDF('test', 'http://www.skosmos.skos/test/ta125', 'text/turtle'); $resultGraph = new EasyRdf\Graph(); $resultGraph->parse($result, "turtle"); diff --git a/tests/PluginRegisterTest.php b/tests/PluginRegisterTest.php index 624cfa189..d0a16aa75 100644 --- a/tests/PluginRegisterTest.php +++ b/tests/PluginRegisterTest.php @@ -46,7 +46,7 @@ protected function setUp() : void 'global-plugin-charlie' => array('js' => array('charlie.js'), 'callback' => array ( 0 => 'charlie'))); $this->mockpr->method('getPlugins')->will($this->returnValue($this->stubplugs)); - $this->model = new Model(new GlobalConfig('/../tests/testconfig.ttl')); + $this->model = new Model(new GlobalConfig('/../../tests/testconfig.ttl')); $this->vocab = $this->model->getVocabulary('test'); } diff --git a/tests/RequestTest.php b/tests/RequestTest.php index 10e7654f8..cae6d1377 100644 --- a/tests/RequestTest.php +++ b/tests/RequestTest.php @@ -14,7 +14,7 @@ protected function setUp() : void bind_textdomain_codeset('skosmos', 'UTF-8'); textdomain('skosmos'); - $config = new GlobalConfig('/../tests/testconfig.ttl'); + $config = new GlobalConfig('/../../tests/testconfig.ttl'); $this->model = new Model($config); $this->request = new Request($this->model); } diff --git a/tests/ResolverTest.php b/tests/ResolverTest.php index 397db2b2d..67cdee84b 100644 --- a/tests/ResolverTest.php +++ b/tests/ResolverTest.php @@ -6,7 +6,7 @@ class ResolverTest extends PHPUnit\Framework\TestCase protected function setUp() : void { - $model = new Model(new GlobalConfig('/../tests/testconfig.ttl')); + $model = new Model(new GlobalConfig('/../../tests/testconfig.ttl')); $this->resolver = new Resolver($model); } diff --git a/tests/RestControllerTest.php b/tests/RestControllerTest.php index 8b90c3dff..ce8e40daf 100644 --- a/tests/RestControllerTest.php +++ b/tests/RestControllerTest.php @@ -1,10 +1,5 @@ model = Mockery::mock(new Model($globalConfig)); $this->controller = new RestController($this->model); } diff --git a/tests/VocabularyCategoryTest.php b/tests/VocabularyCategoryTest.php index 3c77a520d..0bfc1babc 100644 --- a/tests/VocabularyCategoryTest.php +++ b/tests/VocabularyCategoryTest.php @@ -10,7 +10,7 @@ protected function setUp() : void putenv("LANGUAGE=en_GB.utf8"); putenv("LC_ALL=en_GB.utf8"); setlocale(LC_ALL, 'en_GB.utf8'); - $this->model = new Model(new GlobalConfig('/../tests/testconfig.ttl')); + $this->model = new Model(new GlobalConfig('/../../tests/testconfig.ttl')); $this->mockres = $this->getMockBuilder('EasyRdf\Resource')->disableOriginalConstructor()->getMock(); $this->mockres->method('localName')->will($this->returnValue('local name')); } diff --git a/tests/VocabularyConfigTest.php b/tests/VocabularyConfigTest.php index 39b404024..1dc8f7d2f 100644 --- a/tests/VocabularyConfigTest.php +++ b/tests/VocabularyConfigTest.php @@ -15,7 +15,7 @@ protected function setUp() : void putenv("LANGUAGE=en_GB.utf8"); putenv("LC_ALL=en_GB.utf8"); setlocale(LC_ALL, 'en_GB.utf8'); - $this->model = new Model(new GlobalConfig('/../tests/testconfig.ttl')); + $this->model = new Model(new GlobalConfig('/../../tests/testconfig.ttl')); $this->assertNotNull($this->model->getVocabulary('test')->getConfig()->getPluginRegister(), "The PluginRegister of the model was not initialized!"); } diff --git a/tests/VocabularyTest.php b/tests/VocabularyTest.php index e6ac028cb..be4effe0a 100644 --- a/tests/VocabularyTest.php +++ b/tests/VocabularyTest.php @@ -12,8 +12,8 @@ protected function setUp() : void putenv("LANGUAGE=en_GB.utf8"); putenv("LC_ALL=en_GB.utf8"); setlocale(LC_ALL, 'en_GB.utf8'); - $this->model = new Model(new GlobalConfig('/../tests/testconfig.ttl')); - $this->jenamodel = new Model(new GlobalConfig('/../tests/jenatestconfig.ttl')); + $this->model = new Model(new GlobalConfig('/../../tests/testconfig.ttl')); + $this->jenamodel = new Model(new GlobalConfig('/../../tests/jenatestconfig.ttl')); } /** @@ -387,7 +387,7 @@ public function testSearchConceptsAlphabeticalEverything() { * @covers Vocabulary::getCrumbs */ public function testGetBreadCrumbs() { - $model = new Model(new GlobalConfig('/../tests/testconfig.ttl')); + $model = new Model(new GlobalConfig('/../../tests/testconfig.ttl')); $resource = $this->getMockBuilder('EasyRdf\Resource')->disableOriginalConstructor()->getMock(); $vocabstub = $this->getMockBuilder('Vocabulary')->onlyMethods(array('getConceptTransitiveBroaders'))->setConstructorArgs(array($model, $resource))->getMock(); $vocabstub->method('getConceptTransitiveBroaders')->willReturn(array ( 'http://www.yso.fi/onto/yso/p4762' => array ( 'label' => 'objects', ), 'http://www.yso.fi/onto/yso/p1674' => array ( 'label' => 'physical whole', 'direct' => array ( 0 => 'http://www.yso.fi/onto/yso/p4762', ), ), 'http://www.yso.fi/onto/yso/p14606' => array ( 'label' => 'layers', 'direct' => array ( 0 => 'http://www.yso.fi/onto/yso/p1674', ), ), )); @@ -402,7 +402,7 @@ public function testGetBreadCrumbs() { * @covers Vocabulary::getCrumbs */ public function testGetBreadCrumbsShortening() { - $model = new Model(new GlobalConfig('/../tests/testconfig.ttl')); + $model = new Model(new GlobalConfig('/../../tests/testconfig.ttl')); $resource = $this->getMockBuilder('EasyRdf\Resource')->disableOriginalConstructor()->getMock(); $vocabstub = $this->getMockBuilder('Vocabulary')->onlyMethods(array('getConceptTransitiveBroaders'))->setConstructorArgs(array($model, $resource))->getMock(); $vocabstub->method('getConceptTransitiveBroaders')->willReturn(array ( 'http://www.yso.fi/onto/yso/p4762' => array ( 'label' => 'objects', ), 'http://www.yso.fi/onto/yso/p13871' => array ( 'label' => 'thai language', 'direct' => array ( 0 => 'http://www.yso.fi/onto/yso/p10834', ), ), 'http://www.yso.fi/onto/yso/p556' => array ( 'label' => 'languages', 'direct' => array ( 0 => 'http://www.yso.fi/onto/yso/p2881', ), ), 'http://www.yso.fi/onto/yso/p8965' => array ( 'label' => 'Sino-Tibetan languages', 'direct' => array ( 0 => 'http://www.yso.fi/onto/yso/p556', ), ), 'http://www.yso.fi/onto/yso/p3358' => array ( 'label' => 'systems', 'direct' => array ( 0 => 'http://www.yso.fi/onto/yso/p4762', ), ), 'http://www.yso.fi/onto/yso/p10834' => array ( 'label' => 'Tai languages', 'direct' => array ( 0 => 'http://www.yso.fi/onto/yso/p8965', ), ), 'http://www.yso.fi/onto/yso/p2881' => array ( 'label' => 'cultural systems', 'direct' => array ( 0 => 'http://www.yso.fi/onto/yso/p3358', ), ), ) ); @@ -416,7 +416,7 @@ public function testGetBreadCrumbsShortening() { * @covers Vocabulary::getCrumbs */ public function testGetBreadCrumbsCycle() { - $model = new Model(new GlobalConfig('/../tests/testconfig.ttl')); + $model = new Model(new GlobalConfig('/../../tests/testconfig.ttl')); $vocab = $model->getVocabulary('cycle'); $result = $vocab->getBreadCrumbs('en', 'http://www.skosmos.skos/cycle/ta4'); foreach ($result['breadcrumbs'][0] as $crumb) diff --git a/tests/WebControllerTest.php b/tests/WebControllerTest.php index b4ac6f9e9..26c46dc88 100644 --- a/tests/WebControllerTest.php +++ b/tests/WebControllerTest.php @@ -9,7 +9,7 @@ class WebControllerTest extends TestCase protected function setUp() : void { - $globalConfig = new GlobalConfig('/../tests/testconfig.ttl'); + $globalConfig = new GlobalConfig('/../../tests/testconfig.ttl'); $this->model = Mockery::mock(new Model($globalConfig)); $this->webController = new WebController($this->model); } diff --git a/tests/bootstrap.php b/tests/bootstrap.php index f434a4458..1fc97dfe9 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -17,4 +17,4 @@ } require_once(__DIR__ . '/../vendor/autoload.php'); -require_once(__DIR__ . '/../model/Model.php'); +require_once(__DIR__ . '/../src/model/Model.php');