From dd9ffe694a58d2c7dcead82e8daa566df336a662 Mon Sep 17 00:00:00 2001 From: Abdullah Almsaeed Date: Mon, 1 Apr 2019 08:04:44 -0400 Subject: [PATCH] Upgrade testsuite --- README.md | 3 +- composer.json | 2 +- composer.lock | 445 +++++++++++++++------ tests/DataFactory.php | 197 +++++++-- tests/DatabaseSeeders/DevSeedSeeder.php | 382 ++++++++++++++++++ tests/DatabaseSeeders/UsersTableSeeder.php | 28 -- 6 files changed, 858 insertions(+), 199 deletions(-) create mode 100644 tests/DatabaseSeeders/DevSeedSeeder.php delete mode 100644 tests/DatabaseSeeders/UsersTableSeeder.php diff --git a/README.md b/README.md index 6676c0fc..1a48acc9 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,5 @@ [![DOI](https://zenodo.org/badge/58019623.svg)](https://zenodo.org/badge/latestdoi/58019623) - # Tripal Elasticsearch The Tripal Elasticsearch module allows you to easily manage the indexing and display of Elasticsearch on your Tripal @@ -16,4 +15,4 @@ Tripal Elasticsearch is licensed under the [GNU GPLv3](https://www.gnu.org/licen ## Acknowledgement Developed and maintained by [Staton Lab](https://hardwoodgenomics.org/content/about) at the University of Tennessee at Knoxville as part of an NSF grant [CIF21 DIBBS: Tripal Gateway, a Platform for Next-Generation Data Analysis and Sharing](https://nsf.gov/awardsearch/showAward?AWD_ID=1443040) -(PI Stephen Ficklin, Washington State University) \ No newline at end of file +(PI Stephen Ficklin, Washington State University) diff --git a/composer.json b/composer.json index 0416a8bf..f21ca457 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,7 @@ "elasticsearch/elasticsearch": "~6.0", "composer/installers": "~1.0", "phpunit/phpunit": "~7.0", - "statonlab/tripal-test-suite": "~1.1.2" + "statonlab/tripal-test-suite": "1.*" }, "license": "GPLv3", "authors": [ diff --git a/composer.lock b/composer.lock index bf2c6a5e..f226fad5 100644 --- a/composer.lock +++ b/composer.lock @@ -4,21 +4,21 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "9815c8c22cd2727f03b0fded72d1f2aa", + "content-hash": "4d61fe33817db55ce2162790850d8ab8", "packages": [], "packages-dev": [ { "name": "composer/installers", - "version": "v1.5.0", + "version": "v1.6.0", "source": { "type": "git", "url": "https://github.com/composer/installers.git", - "reference": "049797d727261bf27f2690430d935067710049c2" + "reference": "cfcca6b1b60bc4974324efb5783c13dca6932b5b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/installers/zipball/049797d727261bf27f2690430d935067710049c2", - "reference": "049797d727261bf27f2690430d935067710049c2", + "url": "https://api.github.com/repos/composer/installers/zipball/cfcca6b1b60bc4974324efb5783c13dca6932b5b", + "reference": "cfcca6b1b60bc4974324efb5783c13dca6932b5b", "shasum": "" }, "require": { @@ -125,31 +125,33 @@ "zend", "zikula" ], - "time": "2017-12-29T09:13:20+00:00" + "time": "2018-08-27T06:10:37+00:00" }, { "name": "doctrine/instantiator", - "version": "1.1.0", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda" + "reference": "a2c590166b2133a4633738648b6b064edae0814a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", - "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/a2c590166b2133a4633738648b6b064edae0814a", + "reference": "a2c590166b2133a4633738648b6b064edae0814a", "shasum": "" }, "require": { "php": "^7.1" }, "require-dev": { - "athletic/athletic": "~0.1.8", + "doctrine/coding-standard": "^6.0", "ext-pdo": "*", "ext-phar": "*", - "phpunit/phpunit": "^6.2.3", - "squizlabs/php_codesniffer": "^3.0.2" + "phpbench/phpbench": "^0.13", + "phpstan/phpstan-phpunit": "^0.11", + "phpstan/phpstan-shim": "^0.11", + "phpunit/phpunit": "^7.0" }, "type": "library", "extra": { @@ -174,38 +176,40 @@ } ], "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://github.com/doctrine/instantiator", + "homepage": "https://www.doctrine-project.org/projects/instantiator.html", "keywords": [ "constructor", "instantiate" ], - "time": "2017-07-22T11:58:36+00:00" + "time": "2019-03-17T17:37:11+00:00" }, { "name": "elasticsearch/elasticsearch", - "version": "v5.3.2", + "version": "v6.1.0", "source": { "type": "git", "url": "https://github.com/elastic/elasticsearch-php.git", - "reference": "4b29a4121e790bbfe690d5ee77da348b62d48eb8" + "reference": "b237a37b2cdf23a5a17fd3576cdea771394ad00d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/elastic/elasticsearch-php/zipball/4b29a4121e790bbfe690d5ee77da348b62d48eb8", - "reference": "4b29a4121e790bbfe690d5ee77da348b62d48eb8", + "url": "https://api.github.com/repos/elastic/elasticsearch-php/zipball/b237a37b2cdf23a5a17fd3576cdea771394ad00d", + "reference": "b237a37b2cdf23a5a17fd3576cdea771394ad00d", "shasum": "" }, "require": { + "ext-json": ">=1.3.7", "guzzlehttp/ringphp": "~1.0", - "php": "^5.6|^7.0", + "php": "^7.0", "psr/log": "~1.0" }, "require-dev": { "cpliakas/git-wrapper": "~1.0", "doctrine/inflector": "^1.1", "mockery/mockery": "0.9.4", - "phpunit/phpunit": "^4.7|^5.4", - "sami/sami": "~3.2", + "phpstan/phpstan-shim": "0.8.3", + "phpunit/phpunit": "6.3.0", + "squizlabs/php_codesniffer": "3.0.2", "symfony/finder": "^2.8", "symfony/yaml": "^2.8" }, @@ -234,7 +238,7 @@ "elasticsearch", "search" ], - "time": "2017-11-08T17:04:47+00:00" + "time": "2019-01-08T18:53:46+00:00" }, { "name": "fzaninotto/faker", @@ -404,32 +408,33 @@ }, { "name": "guzzlehttp/psr7", - "version": "1.4.2", + "version": "1.5.2", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c" + "reference": "9f83dded91781a01c63574e387eaa769be769115" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/f5b8a8512e2b58b0071a7280e39f14f72e05d87c", - "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/9f83dded91781a01c63574e387eaa769be769115", + "reference": "9f83dded91781a01c63574e387eaa769be769115", "shasum": "" }, "require": { "php": ">=5.4.0", - "psr/http-message": "~1.0" + "psr/http-message": "~1.0", + "ralouphie/getallheaders": "^2.0.5" }, "provide": { "psr/http-message-implementation": "1.0" }, "require-dev": { - "phpunit/phpunit": "~4.0" + "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "1.5-dev" } }, "autoload": { @@ -459,26 +464,27 @@ "keywords": [ "http", "message", + "psr-7", "request", "response", "stream", "uri", "url" ], - "time": "2017-03-20T17:10:46+00:00" + "time": "2018-12-04T20:46:45+00:00" }, { "name": "guzzlehttp/ringphp", - "version": "1.1.0", + "version": "1.1.1", "source": { "type": "git", "url": "https://github.com/guzzle/RingPHP.git", - "reference": "dbbb91d7f6c191e5e405e900e3102ac7f261bc0b" + "reference": "5e2a174052995663dd68e6b5ad838afd47dd615b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/RingPHP/zipball/dbbb91d7f6c191e5e405e900e3102ac7f261bc0b", - "reference": "dbbb91d7f6c191e5e405e900e3102ac7f261bc0b", + "url": "https://api.github.com/repos/guzzle/RingPHP/zipball/5e2a174052995663dd68e6b5ad838afd47dd615b", + "reference": "5e2a174052995663dd68e6b5ad838afd47dd615b", "shasum": "" }, "require": { @@ -516,7 +522,7 @@ } ], "description": "Provides a simple API and specification that abstracts away the details of HTTP into a single PHP function.", - "time": "2015-05-20T03:37:09+00:00" + "time": "2018-07-31T13:22:33+00:00" }, { "name": "guzzlehttp/streams", @@ -872,16 +878,16 @@ }, { "name": "phpspec/prophecy", - "version": "1.7.6", + "version": "1.8.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "33a7e3c4fda54e912ff6338c48823bd5c0f0b712" + "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/33a7e3c4fda54e912ff6338c48823bd5c0f0b712", - "reference": "33a7e3c4fda54e912ff6338c48823bd5c0f0b712", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/4ba436b55987b4bf311cb7c6ba82aa528aac0a06", + "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06", "shasum": "" }, "require": { @@ -893,12 +899,12 @@ }, "require-dev": { "phpspec/phpspec": "^2.5|^3.2", - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5" + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.7.x-dev" + "dev-master": "1.8.x-dev" } }, "autoload": { @@ -931,20 +937,20 @@ "spy", "stub" ], - "time": "2018-04-18T13:57:24+00:00" + "time": "2018-08-05T17:53:17+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "6.0.7", + "version": "6.1.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "865662550c384bc1db7e51d29aeda1c2c161d69a" + "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/865662550c384bc1db7e51d29aeda1c2c161d69a", - "reference": "865662550c384bc1db7e51d29aeda1c2c161d69a", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", + "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", "shasum": "" }, "require": { @@ -955,7 +961,7 @@ "phpunit/php-text-template": "^1.2.1", "phpunit/php-token-stream": "^3.0", "sebastian/code-unit-reverse-lookup": "^1.0.1", - "sebastian/environment": "^3.1", + "sebastian/environment": "^3.1 || ^4.0", "sebastian/version": "^2.0.1", "theseer/tokenizer": "^1.1" }, @@ -968,7 +974,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "6.0-dev" + "dev-master": "6.1-dev" } }, "autoload": { @@ -994,25 +1000,28 @@ "testing", "xunit" ], - "time": "2018-06-01T07:51:50+00:00" + "time": "2018-10-31T16:06:48+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "2.0.1", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "cecbc684605bb0cc288828eb5d65d93d5c676d3c" + "reference": "050bedf145a257b1ff02746c31894800e5122946" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cecbc684605bb0cc288828eb5d65d93d5c676d3c", - "reference": "cecbc684605bb0cc288828eb5d65d93d5c676d3c", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/050bedf145a257b1ff02746c31894800e5122946", + "reference": "050bedf145a257b1ff02746c31894800e5122946", "shasum": "" }, "require": { "php": "^7.1" }, + "require-dev": { + "phpunit/phpunit": "^7.1" + }, "type": "library", "extra": { "branch-alias": { @@ -1041,7 +1050,7 @@ "filesystem", "iterator" ], - "time": "2018-06-11T11:44:00+00:00" + "time": "2018-09-13T20:33:42+00:00" }, { "name": "phpunit/php-text-template", @@ -1086,16 +1095,16 @@ }, { "name": "phpunit/php-timer", - "version": "2.0.0", + "version": "2.1.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "8b8454ea6958c3dee38453d3bd571e023108c91f" + "reference": "8b389aebe1b8b0578430bda0c7c95a829608e059" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/8b8454ea6958c3dee38453d3bd571e023108c91f", - "reference": "8b8454ea6958c3dee38453d3bd571e023108c91f", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/8b389aebe1b8b0578430bda0c7c95a829608e059", + "reference": "8b389aebe1b8b0578430bda0c7c95a829608e059", "shasum": "" }, "require": { @@ -1107,7 +1116,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "2.1-dev" } }, "autoload": { @@ -1131,20 +1140,20 @@ "keywords": [ "timer" ], - "time": "2018-02-01T13:07:23+00:00" + "time": "2019-02-20T10:12:59+00:00" }, { "name": "phpunit/php-token-stream", - "version": "3.0.0", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "21ad88bbba7c3d93530d93994e0a33cd45f02ace" + "reference": "c99e3be9d3e85f60646f152f9002d46ed7770d18" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/21ad88bbba7c3d93530d93994e0a33cd45f02ace", - "reference": "21ad88bbba7c3d93530d93994e0a33cd45f02ace", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/c99e3be9d3e85f60646f152f9002d46ed7770d18", + "reference": "c99e3be9d3e85f60646f152f9002d46ed7770d18", "shasum": "" }, "require": { @@ -1180,20 +1189,20 @@ "keywords": [ "tokenizer" ], - "time": "2018-02-01T13:16:43+00:00" + "time": "2018-10-30T05:52:18+00:00" }, { "name": "phpunit/phpunit", - "version": "7.2.7", + "version": "7.5.7", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "8e878aff7917ef66e702e03d1359b16eee254e2c" + "reference": "eb343b86753d26de07ecba7868fa983104361948" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/8e878aff7917ef66e702e03d1359b16eee254e2c", - "reference": "8e878aff7917ef66e702e03d1359b16eee254e2c", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/eb343b86753d26de07ecba7868fa983104361948", + "reference": "eb343b86753d26de07ecba7868fa983104361948", "shasum": "" }, "require": { @@ -1211,14 +1220,14 @@ "phpunit/php-code-coverage": "^6.0.7", "phpunit/php-file-iterator": "^2.0.1", "phpunit/php-text-template": "^1.2.1", - "phpunit/php-timer": "^2.0", + "phpunit/php-timer": "^2.1", "sebastian/comparator": "^3.0", "sebastian/diff": "^3.0", - "sebastian/environment": "^3.1", + "sebastian/environment": "^4.0", "sebastian/exporter": "^3.1", "sebastian/global-state": "^2.0", "sebastian/object-enumerator": "^3.0.3", - "sebastian/resource-operations": "^1.0", + "sebastian/resource-operations": "^2.0", "sebastian/version": "^2.0.1" }, "conflict": { @@ -1238,7 +1247,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "7.2-dev" + "dev-master": "7.5-dev" } }, "autoload": { @@ -1264,7 +1273,7 @@ "testing", "xunit" ], - "time": "2018-07-15T05:20:50+00:00" + "time": "2019-03-16T07:31:17+00:00" }, { "name": "psr/http-message", @@ -1318,16 +1327,16 @@ }, { "name": "psr/log", - "version": "1.0.2", + "version": "1.1.0", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" + "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "url": "https://api.github.com/repos/php-fig/log/zipball/6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd", + "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd", "shasum": "" }, "require": { @@ -1361,20 +1370,60 @@ "psr", "psr-3" ], - "time": "2016-10-10T12:19:37+00:00" + "time": "2018-11-20T15:27:04+00:00" + }, + { + "name": "ralouphie/getallheaders", + "version": "2.0.5", + "source": { + "type": "git", + "url": "https://github.com/ralouphie/getallheaders.git", + "reference": "5601c8a83fbba7ef674a7369456d12f1e0d0eafa" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/5601c8a83fbba7ef674a7369456d12f1e0d0eafa", + "reference": "5601c8a83fbba7ef674a7369456d12f1e0d0eafa", + "shasum": "" + }, + "require": { + "php": ">=5.3" + }, + "require-dev": { + "phpunit/phpunit": "~3.7.0", + "satooshi/php-coveralls": ">=1.0" + }, + "type": "library", + "autoload": { + "files": [ + "src/getallheaders.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ralph Khattar", + "email": "ralph.khattar@gmail.com" + } + ], + "description": "A polyfill for getallheaders.", + "time": "2016-02-11T07:05:27+00:00" }, { "name": "react/promise", - "version": "v2.7.0", + "version": "v2.7.1", "source": { "type": "git", "url": "https://github.com/reactphp/promise.git", - "reference": "f4edc2581617431aea50430749db55cc3fc031b3" + "reference": "31ffa96f8d2ed0341a57848cbb84d88b89dd664d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/reactphp/promise/zipball/f4edc2581617431aea50430749db55cc3fc031b3", - "reference": "f4edc2581617431aea50430749db55cc3fc031b3", + "url": "https://api.github.com/repos/reactphp/promise/zipball/31ffa96f8d2ed0341a57848cbb84d88b89dd664d", + "reference": "31ffa96f8d2ed0341a57848cbb84d88b89dd664d", "shasum": "" }, "require": { @@ -1407,7 +1456,7 @@ "promise", "promises" ], - "time": "2018-06-13T15:59:06+00:00" + "time": "2019-01-07T21:25:54+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -1520,23 +1569,23 @@ }, { "name": "sebastian/diff", - "version": "3.0.1", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "366541b989927187c4ca70490a35615d3fef2dce" + "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/366541b989927187c4ca70490a35615d3fef2dce", - "reference": "366541b989927187c4ca70490a35615d3fef2dce", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/720fcc7e9b5cf384ea68d9d930d480907a0c1a29", + "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29", "shasum": "" }, "require": { "php": "^7.1" }, "require-dev": { - "phpunit/phpunit": "^7.0", + "phpunit/phpunit": "^7.5 || ^8.0", "symfony/process": "^2 || ^3.3 || ^4" }, "type": "library", @@ -1572,32 +1621,35 @@ "unidiff", "unified diff" ], - "time": "2018-06-10T07:54:39+00:00" + "time": "2019-02-04T06:01:07+00:00" }, { "name": "sebastian/environment", - "version": "3.1.0", + "version": "4.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5" + "reference": "6fda8ce1974b62b14935adc02a9ed38252eca656" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/cd0871b3975fb7fc44d11314fd1ee20925fce4f5", - "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6fda8ce1974b62b14935adc02a9ed38252eca656", + "reference": "6fda8ce1974b62b14935adc02a9ed38252eca656", "shasum": "" }, "require": { - "php": "^7.0" + "php": "^7.1" }, "require-dev": { - "phpunit/phpunit": "^6.1" + "phpunit/phpunit": "^7.5" + }, + "suggest": { + "ext-posix": "*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1.x-dev" + "dev-master": "4.1-dev" } }, "autoload": { @@ -1622,7 +1674,7 @@ "environment", "hhvm" ], - "time": "2017-07-01T08:51:00+00:00" + "time": "2019-02-01T05:27:49+00:00" }, { "name": "sebastian/exporter", @@ -1889,25 +1941,25 @@ }, { "name": "sebastian/resource-operations", - "version": "1.0.0", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52" + "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/4d7a795d35b889bf80a0cc04e08d77cedfa917a9", + "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9", "shasum": "" }, "require": { - "php": ">=5.6.0" + "php": "^7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -1927,7 +1979,7 @@ ], "description": "Provides a list of PHP built-in functions that operate on resources", "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "time": "2015-07-28T20:34:47+00:00" + "time": "2018-10-04T04:07:39+00:00" }, { "name": "sebastian/version", @@ -1974,16 +2026,16 @@ }, { "name": "statonlab/tripal-test-suite", - "version": "1.1.2", + "version": "1.6.0", "source": { "type": "git", - "url": "https://github.com/statonlab/TripalTestSuite.git", - "reference": "ca85284fc1da9c9f2863353dcb6eefe6d4b39343" + "url": "https://github.com/tripal/TripalTestSuite.git", + "reference": "c3fc5e6c13be81c94522bec2afb1f9c9ea3cd4e1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/statonlab/TripalTestSuite/zipball/ca85284fc1da9c9f2863353dcb6eefe6d4b39343", - "reference": "ca85284fc1da9c9f2863353dcb6eefe6d4b39343", + "url": "https://api.github.com/repos/tripal/TripalTestSuite/zipball/c3fc5e6c13be81c94522bec2afb1f9c9ea3cd4e1", + "reference": "c3fc5e6c13be81c94522bec2afb1f9c9ea3cd4e1", "shasum": "" }, "require": { @@ -2018,30 +2070,34 @@ "email": "bcondon@utk.edu" } ], - "time": "2018-06-28T17:01:37+00:00" + "time": "2019-03-19T17:48:32+00:00" }, { "name": "symfony/console", - "version": "v4.1.2", + "version": "v4.2.4", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "5c31f6a97c1c240707f6d786e7e59bfacdbc0219" + "reference": "9dc2299a016497f9ee620be94524e6c0af0280a9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/5c31f6a97c1c240707f6d786e7e59bfacdbc0219", - "reference": "5c31f6a97c1c240707f6d786e7e59bfacdbc0219", + "url": "https://api.github.com/repos/symfony/console/zipball/9dc2299a016497f9ee620be94524e6c0af0280a9", + "reference": "9dc2299a016497f9ee620be94524e6c0af0280a9", "shasum": "" }, "require": { "php": "^7.1.3", + "symfony/contracts": "^1.0", "symfony/polyfill-mbstring": "~1.0" }, "conflict": { "symfony/dependency-injection": "<3.4", "symfony/process": "<3.3" }, + "provide": { + "psr/log-implementation": "1.0" + }, "require-dev": { "psr/log": "~1.0", "symfony/config": "~3.4|~4.0", @@ -2051,7 +2107,7 @@ "symfony/process": "~3.4|~4.0" }, "suggest": { - "psr/log-implementation": "For using the console logger", + "psr/log": "For using the console logger", "symfony/event-dispatcher": "", "symfony/lock": "", "symfony/process": "" @@ -2059,7 +2115,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.1-dev" + "dev-master": "4.2-dev" } }, "autoload": { @@ -2086,20 +2142,146 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2018-07-16T14:05:40+00:00" + "time": "2019-02-23T15:17:42+00:00" + }, + { + "name": "symfony/contracts", + "version": "v1.0.2", + "source": { + "type": "git", + "url": "https://github.com/symfony/contracts.git", + "reference": "1aa7ab2429c3d594dd70689604b5cf7421254cdf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/contracts/zipball/1aa7ab2429c3d594dd70689604b5cf7421254cdf", + "reference": "1aa7ab2429c3d594dd70689604b5cf7421254cdf", + "shasum": "" + }, + "require": { + "php": "^7.1.3" + }, + "require-dev": { + "psr/cache": "^1.0", + "psr/container": "^1.0" + }, + "suggest": { + "psr/cache": "When using the Cache contracts", + "psr/container": "When using the Service contracts", + "symfony/cache-contracts-implementation": "", + "symfony/service-contracts-implementation": "", + "symfony/translation-contracts-implementation": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\": "" + }, + "exclude-from-classmap": [ + "**/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "A set of abstractions extracted out of the Symfony components", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "time": "2018-12-05T08:06:11+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.11.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "82ebae02209c21113908c229e9883c419720738a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/82ebae02209c21113908c229e9883c419720738a", + "reference": "82ebae02209c21113908c229e9883c419720738a", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.11-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + }, + { + "name": "Gert de Pagter", + "email": "backendtea@gmail.com" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "time": "2019-02-06T07:57:58+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.8.0", + "version": "v1.11.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "3296adf6a6454a050679cde90f95350ad604b171" + "reference": "fe5e94c604826c35a32fa832f35bd036b6799609" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/3296adf6a6454a050679cde90f95350ad604b171", - "reference": "3296adf6a6454a050679cde90f95350ad604b171", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/fe5e94c604826c35a32fa832f35bd036b6799609", + "reference": "fe5e94c604826c35a32fa832f35bd036b6799609", "shasum": "" }, "require": { @@ -2111,7 +2293,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.8-dev" + "dev-master": "1.11-dev" } }, "autoload": { @@ -2145,7 +2327,7 @@ "portable", "shim" ], - "time": "2018-04-26T10:06:28+00:00" + "time": "2019-02-06T07:57:58+00:00" }, { "name": "theseer/tokenizer", @@ -2189,20 +2371,21 @@ }, { "name": "webmozart/assert", - "version": "1.3.0", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/webmozart/assert.git", - "reference": "0df1908962e7a3071564e857d86874dad1ef204a" + "reference": "83e253c8e0be5b0257b881e1827274667c5c17a9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/0df1908962e7a3071564e857d86874dad1ef204a", - "reference": "0df1908962e7a3071564e857d86874dad1ef204a", + "url": "https://api.github.com/repos/webmozart/assert/zipball/83e253c8e0be5b0257b881e1827274667c5c17a9", + "reference": "83e253c8e0be5b0257b881e1827274667c5c17a9", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0" + "php": "^5.3.3 || ^7.0", + "symfony/polyfill-ctype": "^1.8" }, "require-dev": { "phpunit/phpunit": "^4.6", @@ -2235,7 +2418,7 @@ "check", "validate" ], - "time": "2018-01-29T19:49:41+00:00" + "time": "2018-12-25T11:19:39+00:00" } ], "aliases": [], diff --git a/tests/DataFactory.php b/tests/DataFactory.php index 6db7689e..dcde97da 100644 --- a/tests/DataFactory.php +++ b/tests/DataFactory.php @@ -13,61 +13,184 @@ /** @see StatonLab\TripalTestSuite\Database\Factory::define() */ Factory::define('chado.cv', function (Faker\Generator $faker) { - return [ - 'name' => $faker->name, - 'definition' => $faker->text, - ]; + return [ + 'name' => $faker->unique()->word . uniqid(), + // 'name' => $faker->unique($reset = TRUE)->word , + 'definition' => $faker->text, + ]; }); /** @see StatonLab\TripalTestSuite\Database\Factory::define() */ Factory::define('chado.db', function (Faker\Generator $faker) { - return [ - 'name' => $faker->name, - 'description' => $faker->text, - 'urlprefix' => $faker->url, - 'url' => $faker->url, - ]; + return [ + 'name' => $faker->unique()->word . uniqid(), + 'description' => $faker->text, + 'urlprefix' => $faker->url, + 'url' => $faker->url, + ]; }); /** @see StatonLab\TripalTestSuite\Database\Factory::define() */ Factory::define('chado.dbxref', function (Faker\Generator $faker) { - return [ - 'db_id' => factory('chado.db')->create()->db_id, - 'accession' => $faker->numberBetween(), - 'version' => $faker->numberBetween(), - 'description' => $faker->text, - ]; + return [ + 'db_id' => factory('chado.db')->create()->db_id, + 'accession' => $faker->numberBetween(), + 'version' => $faker->numberBetween(), + 'description' => $faker->text, + ]; }); /** @see StatonLab\TripalTestSuite\Database\Factory::define() */ Factory::define('chado.cvterm', function (Faker\Generator $faker) { - return [ - 'cv_id' => factory('chado.cv')->create()->cv_id, - 'dbxref_id' => factory('chado.dbxref')->create()->dbxref_id, - 'name' => $faker->name, - 'definition' => $faker->text, - 'is_obsolete' => 0, - 'is_relationshiptype' => 0, - ]; + return [ + 'cv_id' => factory('chado.cv')->create()->cv_id, + 'dbxref_id' => factory('chado.dbxref')->create()->dbxref_id, + 'name' => $faker->word, + 'definition' => $faker->text, + 'is_obsolete' => 0, + 'is_relationshiptype' => 0, + ]; }); /** @see StatonLab\TripalTestSuite\Database\Factory::define() */ Factory::define('chado.organism', function (Faker\Generator $faker) { - return [ - 'abbreviation' => $faker->name, - 'genus' => $faker->name, - 'species' => $faker->name, - 'common_name' => $faker->name, - 'type_id' => factory('chado.cvterm')->create()->cvterm_id, - ]; + $genus = $faker->word; + $species = $faker->word; + $abbr = substr($genus, 0, 1) . ". " . $species; + + return [ + 'abbreviation' => $abbr, + 'genus' => $genus, + 'species' => $faker->name, + 'common_name' => $faker->word, + 'type_id' => factory('chado.cvterm')->create()->cvterm_id, + ]; }); /** @see StatonLab\TripalTestSuite\Database\Factory::define() */ Factory::define('chado.feature', function (Faker\Generator $faker) { - return [ - 'name' => $faker->name, - 'uniquename' => $faker->unique()->name, - 'organism_id' => factory('chado.organism')->create()->organism_id, - 'type_id' => factory('chado.cvterm')->create()->cvterm_id, - ]; + return [ + 'name' => $faker->word, + 'uniquename' => $faker->unique()->word, + 'organism_id' => factory('chado.organism')->create()->organism_id, + 'type_id' => factory('chado.cvterm')->create()->cvterm_id, + ]; +}); + +/** @see StatonLab\TripalTestSuite\Database\Factory::define() */ +Factory::define('chado.analysis', function (Faker\Generator $faker) { + return [ + 'name' => $faker->word, + 'description' => $faker->text, + 'program' => $faker->unique()->word, + 'programversion' => $faker->unique()->word, + 'sourcename' => $faker->unique()->word, + 'algorithm' => $faker->word, + 'sourcename' => $faker->word, + 'sourceversion' => $faker->word, + 'sourceuri' => $faker->word, + // 'timeexecuted' => $faker->time()// needs to match 2018-03-23 15:08:00.000000 + ]; +}); + +/** @see StatonLab\TripalTestSuite\Database\Factory::define() */ +Factory::define('chado.contact', function (Faker\Generator $faker) { + return [ + 'type_id' => factory('chado.cvterm')->create()->cvterm_id, + 'name' => $faker->name, + 'description' => $faker->text, + ]; +}); + +/** @see StatonLab\TripalTestSuite\Database\Factory::define() */ +Factory::define('chado.biomaterial', function (Faker\Generator $faker) { + return [ + + 'taxon_id' => factory('chado.organism')->create()->organism_id, + 'biosourceprovider_id' => factory('chado.contact')->create()->contact_id, + 'dbxref_id' => factory('chado.dbxref')->create()->dbxref_id, + 'name' => $faker->unique()->word, + 'description' => $faker->text, + + ]; +}); + +/** @see StatonLab\TripalTestSuite\Database\Factory::define() */ +Factory::define('chado.featuremap', function (Faker\Generator $faker) { + return [ + 'name' => $faker->unique()->word, + 'description' => $faker->text, + 'unittype_id' => factory('chado.cvterm')->create()->cvterm_id, + ]; +}); + +/** @see StatonLab\TripalTestSuite\Database\Factory::define() */ +Factory::define('chado.featurepos', function (Faker\Generator $faker) { + return [ + 'featuremap_id' => factory('chado.featuremap')->create()->featuremap_id, + 'feature_id' => factory('chado.feature')->create()->feature_id, + 'map_feature_id' => factory('chado.feature')->create()->feature_id, + 'mappos' => $faker->randomFloat, + ]; +}); + +/** + * IMPORTANT!!!! + * ============================================================== + * IF you use this factory, call + * + * $prev_db = chado_set_active('chado'); + * + * beforehand, and + * + * chado_set_active($prev_db); + * + * afterwards. + * + * @see StatonLab\TripalTestSuite\Database\Factory::define() + */ +Factory::define('chado.featureloc', function (Faker\Generator $faker) { + $a = $faker->randomNumber; + $b = $faker->randomNumber; + + return [ + 'feature_id' => factory('chado.feature')->create()->feature_id, + 'srcfeature_id' => factory('chado.feature')->create()->feature_id, + 'fmin' => min([$a, $b]), + 'is_fmin_partial' => 0, + 'fmax' => max([$a, $b]), + 'is_fmax_partial' => 0, + 'strand' => NULL, + 'phase' => NULL, + 'residue_info' => $faker->word, + 'locgroup' => 0, + 'rank' => 0, + ]; +}); + +/** @see StatonLab\TripalTestSuite\Database\Factory::define() */ +Factory::define('chado.library', function (Faker\Generator $faker) { + return [ + 'organism_id' => factory('chado.organism')->create()->organism_id, + 'name' => $faker->word, + 'uniquename' => $faker->unique()->word, + 'type_id' => factory('chado.cvterm')->create()->cvterm_id, + 'is_obsolete' => 0, + ]; +}); + +/** @see StatonLab\TripalTestSuite\Database\Factory::define() */ +Factory::define('chado.project', function (Faker\Generator $faker) { + return [ + 'name' => $faker->word, + 'description' => $faker->text, + ]; +}); + +/** @see StatonLab\TripalTestSuite\Database\Factory::define() */ +Factory::define('chado.pub', function (Faker\Generator $faker) { + return [ + 'uniquename' => $faker->word, + 'type_id' => factory('chado.cvterm')->create()->cvterm_id, + ]; }); diff --git a/tests/DatabaseSeeders/DevSeedSeeder.php b/tests/DatabaseSeeders/DevSeedSeeder.php new file mode 100644 index 00000000..9b61e892 --- /dev/null +++ b/tests/DatabaseSeeders/DevSeedSeeder.php @@ -0,0 +1,382 @@ + 'F. excelsior miniature', + 'genus' => 'Fraxinus', + 'species' => 'excelsior', + 'abbreviation' => 'F. excelsor', + 'comment' => 'Loaded with TripalDev Seed.', + ]; + +protected $sequence_analysis = [ + 'name' => 'Fraxinus exclesior miniature dataset', + 'description' => 'Tripal Dev Seed', + ]; + + protected $expression_analysis = [ + + 'name' => 'Fraxinus exclesior miniature dataset Expression Analysis', + 'description' => 'Tripal Dev Seed', + ]; + + protected $blastdb = [ + 'name' => 'DevSeed Database: TREMBL', + 'description' => 'A dummy database created by DevSeed', + ]; + + /** + * Part 2: + * Files. + * Each importer will take a file argument. This argument should be an array + * with one of the following two keys: file_remote => url where the file is + * located file_local => server path where the file is located. + */ + + protected $landmark_file = ['file_remote' => 'https://raw.githubusercontent.com/statonlab/tripal_dev_seed/master/Fexcel_mini/sequences/empty_landmarks.fasta']; + + protected $landmark_type = 'supercontig'; + + protected $mRNA_file = ['file_remote' => 'https://raw.githubusercontent.com/statonlab/tripal_dev_seed/master/Fexcel_mini/sequences/mrna_mini.fasta']; + + protected $protein_file = ['file_remote' => 'https://raw.githubusercontent.com/statonlab/tripal_dev_seed/master/Fexcel_mini/sequences/polypeptide_mini.fasta']; + + protected $gff_file = ['file_remote' => 'https://raw.githubusercontent.com/statonlab/tripal_dev_seed/master/Fexcel_mini/gff/filtered.gff']; + + protected $blast_file = ['file_remote' => 'https://raw.githubusercontent.com/statonlab/tripal_dev_seed/master/Fexcel_mini/gff/filtered.gff']; + + protected $biomaterial_file = ['file_remote' => 'https://raw.githubusercontent.com/statonlab/tripal_dev_seed/master/Fexcel_mini/biomaterials/biomaterials.xml']; + + protected $expression_file = ['file_remote' => 'https://raw.githubusercontent.com/statonlab/tripal_dev_seed/master/Fexcel_mini/expression/expression.tsv']; + + protected $interpro_file = ['file_remote' => 'https://raw.githubusercontent.com/statonlab/tripal_dev_seed/master/Fexcel_mini/ips/polypeptide_mini.fasta.xml']; + + // Regular expression that will link the protein name to the mRNA parent feature name. + // protected $prot_regexp = '/(FRA.*?)(?=:)/'; + + protected $prot_regexp = null; + + public function __construct() + { + + if ($this->organism) { + + try { + $organism = $this->fetch_chado_record('chado.organism', [ + 'common_name', + 'organism_id', + ], $this->organism); + } catch (\Exception $e) { + echo $e->getMessage(); + exit; + } + + $this->organism = $organism; + + if ($this->sequence_analysis) { + + try { + $seq_analysis = $this->fetch_chado_record('chado.analysis', ['analysis_id'], + $this->sequence_analysis); + } catch (\Exception $e) { + echo $e->getMessage(); + exit; + } + $this->sequence_analysis = $seq_analysis; + } + + if ($this->expression_analysis) { + try { + $expression_analysis = $this->fetch_chado_record('chado.analysis', ['analysis_id'], + $this->expression_analysis); + } catch (\Exception $e) { + echo $e->getMessage(); + exit; + } + + $this->expression_analysis = $expression_analysis; + } + } + + if ($this->blastdb) { + try { + $blastdb = $this->fetch_chado_record('chado.db', ['db_id'], $this->blastdb); + } catch (\Excetion $e) { + echo $e->getMessage(); + } + + $this->blastdb = $blastdb; + } + } + + /** + * Runs all loaders. + * Will only run loaders where the files have been uncommented at the start + * of the class. + */ + public function up() + { + + if ($this->landmark_file) { + + $run_args = [ + 'organism_id' => $this->organism->organism_id, + 'analysis_id' => $this->sequence_analysis->analysis_id, + 'seqtype' => $this->landmark_type, + 'method' => 2, //default insert and update + 'match_type' => 1, //unique name default + //optional + 're_name' => null, + 're_uname' => null, + 're_accession' => null, + 'db_id' => null, + 'rel_type' => null, + 're_subject' => null, + 'parent_type' => null, + ]; + $this->load_landmarks($run_args, $this->landmark_file); + } + + if ($this->gff_file) { + $run_args = [ + 'analysis_id' => $this->sequence_analysis->analysis_id, + 'organism_id' => $this->organism->organism_id, + 'use_transaction' => 1, + 'add_only' => 0, + 'update' => 1, + 'create_organism' => 0, + 'create_target' => 0, + + ///regexps for mRNA and protein. + 're_mrna' => null, + 're_protein' => $this->prot_regexp, + //optional + 'target_organism_id' => null, + 'target_type' => null, + 'start_line' => null, + 'landmark_type' => null, + 'alt_id_attr' => null, + ]; + $this->load_GFF($run_args, $this->gff_file); + } + + if ($this->mRNA_file) { + + $run_args = [ + 'organism_id' => $this->organism->organism_id, + 'analysis_id' => $this->sequence_analysis->analysis_id, + 'seqtype' => 'mRNA', + 'method' => 2, //default insert and update + 'match_type' => 1, //unique name default + //optional + 're_name' => null, + 're_uname' => null, + 're_accession' => null, + 'db_id' => null, + 'rel_type' => null, + 're_subject' => null, + 'parent_type' => null, + ]; + $this->load_mRNA_FASTA($run_args, $this->mRNA_file); + } + + if ($this->protein_file) { + $run_args = [ + 'organism_id' => $this->organism->organism_id, + 'analysis_id' => $this->sequence_analysis->analysis_id, + 'seqtype' => 'polypeptide', + 'method' => 2, + 'match_type' => 1, + //optional + 're_name' => null, + 're_uname' => null, + 're_accession' => null, + 'db_id' => null, + ]; + + if ($this->prot_regexp) { + //links polypeptide to mRNA + $run_args['rel_type'] = 'derives_from'; + $run_args['re_subject'] = $this->prot_regexp; + $run_args['parent_type'] = 'mRNA'; + } + $this->load_polypeptide_FASTA($run_args, $this->protein_file); + } + + if ($this->interpro_file) { + + $run_args = [ + 'analysis_id' => $this->sequence_analysis->analysis_id, + //optional + 'query_type' => 'mRNA', + 'query_re' => $this->prot_regexp, + 'query_uniquename' => null, + 'parsego' => true, + ]; + + $this->load_interpro_annotations($run_args, $this->interpro_file); + } + + if ($this->blast_file) { + $run_args = [ + 'analysis_id' => $this->sequence_analysis->analysis_id, + 'no_parsed' => 25,//number results to parse + 'query_type' => 'mRNA', + //optional + 'blastdb' => $this->blastdb->db_id, + 'blastfile_ext' => null, + 'is_concat' => 0, + 'query_re' => null, + 'query_uniquename' => 0, + ]; + + $this->load_blast_annotations($run_args, $this->blast_file); + } + + if ($this->biomaterial_file) { + $run_args = [ + 'organism_id' => $this->organism->organism_id, + 'analysis_id' => $this->sequence_analysis->analysis_id, + ]; + //optional: specifies specific CVterms for properties/property values. Not used here. + //'cvterm_configuration' => NULL, + //'cvalue_configuration' => NULL]; + + $this->load_biomaterials($run_args, $this->biomaterial_file); + } + + if ($this->expression_file) { + $run_args = [ + 'filetype' => 'mat', //matrix file type + 'organism_id' => $this->organism->organism_id, + 'analysis_id' => $this->sequence_analysis->analysis_id, + //optional + 'fileext' => null, + 're_start' => null, + 're_stop' => null, + 'feature_uniquenames' => null, + 'quantificationunits' => null, + ]; + $this->load_expression($run_args, $this->expression_file); + } + } + + private function load_landmarks($run_args, $file) + { + module_load_include('inc', 'tripal_chado', 'includes/TripalImporter/FASTAImporter'); + + $importer = new \FASTAImporter(); + $importer->create($run_args, $file); + $importer->prepareFiles(); + $importer->run(); + } + + private function load_mRNA_FASTA($run_args, $file) + { + module_load_include('inc', 'tripal_chado', 'includes/TripalImporter/FASTAImporter'); + + $importer = new \FASTAImporter(); + $importer->create($run_args, $file); + $importer->prepareFiles(); + $importer->run(); + } + + private function load_polypeptide_FASTA($run_args, $file) + { + module_load_include('inc', 'tripal_chado', 'includes/TripalImporter/FASTAImporter'); + + $importer = new \FASTAImporter(); + $importer->create($run_args, $file); + $importer->prepareFiles(); + $importer->run(); + } + + private function load_interpro_annotations($run_args, $file) + { + module_load_include('inc', 'tripal_analysis_interpro', 'includes/TripalImporter/InterProImporter'); + + $importer = new \InterProImporter(); + $importer->create($run_args, $file); + $importer->prepareFiles(); + $importer->run(); + } + + private function load_GFF($run_args, $file) + { + module_load_include('inc', 'tripal_chado', 'includes/TripalImporter/GFF3Importer'); + + $importer = new \GFF3Importer(); + $importer->create($run_args, $file); + $importer->prepareFiles(); + $importer->run(); + } + + private function load_blast_annotations($run_args, $file) + { + module_load_include('inc', 'tripal_analysis_blast', 'includes/TripalImporter/BlastImporter'); + + $importer = new \BlastImporter(); + $importer->create($run_args, $file); + $importer->prepareFiles(); + $importer->run(); + } + + private function load_biomaterials($run_args, $file) + { + module_load_include('inc', 'tripal_biomaterial', 'includes/TripalImporter/tripal_biomaterial_loader_v3'); + + $importer = new \tripal_biomaterial_loader_v3(); + $importer->create($run_args, $file); + $importer->prepareFiles(); + $importer->run(); + } + + private function load_expression($run_args, $file) + { + module_load_include('inc', 'tripal_analysis_expression', + 'includes/TripalImporter/tripal_expression_data_loader'); + + $importer = new \tripal_expression_data_loader(); + $importer->create($run_args, $file); + $importer->prepareFiles(); + $importer->run(); + } + + private function fetch_chado_record($table, $fields, $factory_array) + { + $query = db_select($table, 't')->fields('t', $fields); + + foreach ($factory_array as $key => $value) { + $query->condition($key, $value); + } + + $count_query = $query; + $count = (int) $count_query->countQuery()->execute()->fetchField(); + + if ($count === 0) { + return factory($table)->create($factory_array); + } + + if ($count === 1) { + return $query->execute()->fetchObject(); + } + + throw new Exception("Error creating object for: ".$table.".\n Array supplied matches ".$count_query." results, must match 1."); + } +} diff --git a/tests/DatabaseSeeders/UsersTableSeeder.php b/tests/DatabaseSeeders/UsersTableSeeder.php deleted file mode 100644 index 2d28f29b..00000000 --- a/tests/DatabaseSeeders/UsersTableSeeder.php +++ /dev/null @@ -1,28 +0,0 @@ - 'test user', - 'pass' => 'secret', - 'mail' => 'test@example.com', - 'status' => 1, - 'init' => 'Email', - 'roles' => [ - DRUPAL_AUTHENTICATED_RID => 'authenticated user', - ], - ]; - - // The first parameter is sent blank so a new user is created. - user_save(new \stdClass(), $new_user); - } -}