forked from scholarslab/SolrSearch
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated test code for newer Omeka; all tests now pass
Version is set to 2.4.0-ehri for eventual release. Requires running again latest Omeka builds however that are compatible w/ PHP 8.0. This includes CI config for Travis and Github Actions but after lots of teeth gnashing that still fail w/ MySQL timeout errors for reasons I do not understand.
- Loading branch information
Showing
48 changed files
with
4,014 additions
and
494 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
name: Run Tests | ||
|
||
on: | ||
push: | ||
pull_request: | ||
|
||
env: | ||
OMEKA_DIR: Omeka | ||
DB_DATABASE: omeka_test | ||
DB_USER: root | ||
DB_PASSWORD: root | ||
|
||
|
||
jobs: | ||
phpunit: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Set up MySQL | ||
run: | | ||
sudo /etc/init.d/mysql start | ||
mysql -e 'CREATE DATABASE ${{ env.DB_DATABASE }};' -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }} | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set permissions on Solr core | ||
run: chmod 0777 solr-core/omeka | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: 7.4 | ||
extensions: mbstring, xml, xsl, mysql, gd | ||
ini-values: post_max_size=256M, max_execution_time=180 | ||
|
||
- name: Build the docker-compose stack | ||
run: docker-compose up -d | ||
|
||
- name: Create solr.ini | ||
run: | | ||
cat <<EOF > tests/phpunit/solr.ini | ||
port = 18983 | ||
server = localhost | ||
core = /solr/omeka/ | ||
EOF | ||
- name: Setup host Omeka instance | ||
run: | | ||
git clone https://github.com/omeka/Omeka.git | ||
cd Omeka | ||
git checkout 08bfdf470e234edb68e5307a2fef8c899d89256c | ||
mv application/config/config.ini.changeme application/config/config.ini | ||
mv application/tests/config.ini.changeme application/tests/config.ini | ||
mv db.ini.changeme db.ini | ||
for f in db.ini application/tests/config.ini | ||
do | ||
sed -Ei 's/(db\.)?host\s*=\s*"[^"]*"/\1host = "127.0.0.1"/' $f | ||
sed -Ei 's/(db\.)?username\s*=\s*"[^"]*"/\1username = "${{ env.DB_USER }}"/' $f | ||
sed -Ei 's/(db\.)?password\s*=\s*"[^"]*"/\1password = "${{ env.DB_PASSWORD}}"/' $f | ||
sed -Ei 's/(db\.)?dbname\s*=\s*"[^"]*"/\1dbname = "${{ env.DB_DATABASE }}"\n\1port = 3306/' $f | ||
done | ||
composer -q update | ||
composer install -q --no-ansi --no-interaction --no-scripts --no-progress | ||
- name: Install dependencies | ||
run: | | ||
composer -q update | ||
composer install -q --no-ansi --no-interaction --no-scripts --no-progress | ||
- name: Run test suite | ||
run: composer -vvv test | ||
# run: php test.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,4 @@ pkg | |
|
||
tests/phpunit/solr.ini | ||
solr-core/omeka/data | ||
tests/phpunit/.phpunit.result.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
language: php | ||
|
||
matrix: | ||
include: | ||
- php: 7.2 | ||
dist: bionic | ||
|
||
services: | ||
- mysql | ||
- docker | ||
|
||
sudo: false | ||
|
||
env: | ||
- OMEKA_DIR=./Omeka | ||
|
||
before_install: | ||
- docker-compose up -d | ||
|
||
before_script: | ||
- set -e | ||
- git clone https://github.com/omeka/Omeka | ||
- cd Omeka | ||
- git checkout 08bfdf470e234edb68e5307a2fef8c899d89256c | ||
- mysql -e "create database IF NOT EXISTS omeka_test;" -uroot | ||
- mv application/config/config.ini.changeme application/config/config.ini | ||
- mv application/tests/config.ini.changeme application/tests/config.ini | ||
- mv db.ini.changeme db.ini | ||
- | | ||
for f in db.ini application/tests/config.ini | ||
do | ||
sed -Ei 's/(db\.)?host\s*=\s*"[^"]*"/\1host = "127.0.0.1"/' $f | ||
sed -Ei 's/(db\.)?username\s*=\s*"[^"]*"/\1username = "root"/' $f | ||
sed -Ei 's/(db\.)?password\s*=\s*"[^"]*"/\1password = ""/' $f | ||
sed -Ei 's/(db\.)?dbname\s*=\s*"[^"]*"/\1dbname = "omeka_test"/' $f | ||
done | ||
- composer -q update | ||
- composer install -q --no-ansi --no-interaction --no-scripts --no-progress | ||
- cd .. | ||
- | | ||
cat <<EOF > tests/phpunit/solr.ini | ||
port = 18983 | ||
server = localhost | ||
core = /solr/omeka/ | ||
EOF | ||
- chmod 0777 solr-core/omeka | ||
|
||
script: | ||
- composer -q update | ||
- composer install -q --no-ansi --no-interaction --no-scripts --no-progress | ||
- composer test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
{ | ||
"require-dev": { | ||
"phpunit/phpunit": "^4.8" | ||
"phpunit/phpunit": "^4.8|^6|^7|^8" | ||
}, | ||
"scripts": { | ||
"test": "./vendor/bin/phpunit -c tests/phpunit/phpunit.xml tests" | ||
}, | ||
"require": { | ||
"ext-mysqli": "*" | ||
} | ||
} |
Oops, something went wrong.