diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000000..cb289c6871 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,44 @@ +language: php +services: + - mysql + - postgresql + - redis-server + - memcached +php: + - 7.4.6 +before_install: + - yes | pecl install memcache + - no | pecl install memcached + - echo "extension = redis.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini + - mysql -e 'CREATE DATABASE onphp;' + - psql -c 'create database onphp;' -U postgres + - cp ./tests/travis.inc.php.tpl ./tests/config.inc.php + +install: + - composer update -n + +before_script: + - wget https://repo.mysql.com//mysql-apt-config_0.8.15-1_all.deb + - sudo dpkg -i mysql-apt-config_0.8.15-1_all.deb + - sudo apt-get update -q + - sudo apt-get install -q -y --allow-unauthenticated -o Dpkg::Options::=--force-confnew mysql-server + - sudo systemctl restart mysql + - sudo mysql_upgrade + - mysql --version + + + - sudo apt-get install -q -y apache2 libapache2-mod-fastcgi + - sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf + - sudo a2enmod rewrite actions fastcgi alias + - echo "cgi.fix_pathinfo = 1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini + - sudo sed -i -e "s,www-data,travis,g" /etc/apache2/envvars + - sudo chown -R travis:travis /var/lib/apache2/fastcgi + - ~/.phpenv/versions/$(phpenv version-name)/sbin/php-fpm + # configure apache virtual hosts + - sudo cp -f travis/travis-ci-apache /etc/apache2/sites-available/000-default.conf + - sudo sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place /etc/apache2/sites-available/000-default.conf + - sudo service apache2 restart + #- curl -vsf 'http://localhost/curlTest.php' &> /dev/stdout + +script: + - ./vendor/bin/phpunit --exclude-group amqp,cookie,mail,pinba --verbose --dont-report-useless-tests ./tests/AllTests.php \ No newline at end of file diff --git a/tests/travis.inc.php.tpl b/tests/travis.inc.php.tpl new file mode 100644 index 0000000000..e200c1c793 --- /dev/null +++ b/tests/travis.inc.php.tpl @@ -0,0 +1,50 @@ + array( + 'user' => 'postgres', + 'pass' => '', + 'host' => '127.0.0.1', + 'base' => 'onphp' + ), + MySQLim::class => array( + 'user' => 'root', + 'pass' => '', + 'host' => 'localhost', + 'base' => 'onphp' + ), + SQLitePDO::class => array( + 'user' => 'onphp', + 'pass' => 'onphp', + 'host' => '127.0.0.1', + 'base' => 'onphp' + ), +); + +$daoWorkers = array( + VoodooDaoWorker::class, + CommonDaoWorker::class, + SmartDaoWorker::class, + VoodooDaoWorker::class, + CacheDaoWorker::class, + VoodooDaoWorker::class, + SmartDaoWorker::class, + CommonDaoWorker::class, + NullDaoWorker::class +); + +VoodooDaoWorker::setDefaultHandler(CacheSegmentHandler::class); + +define('__LOCAL_DEBUG__', true); +define('ONPHP_CURL_TEST_URL', 'http://localhost/curlTest.php'); //set here url to test script test/main/data/curlTest/curlTest.php +?> \ No newline at end of file diff --git a/travis/travis-ci-apache b/travis/travis-ci-apache new file mode 100644 index 0000000000..e75152f7a3 --- /dev/null +++ b/travis/travis-ci-apache @@ -0,0 +1,25 @@ + + # [...] + + DocumentRoot %TRAVIS_BUILD_DIR%/tests/Main/data/curlTest + + + Options FollowSymLinks MultiViews ExecCGI + AllowOverride All + Require all granted + + + # Wire up Apache to use Travis CI's php-fpm. + + AddHandler php5-fcgi .php + Action php5-fcgi /php5-fcgi + Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi + FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -host 127.0.0.1:9000 -pass-header Authorization + + + Require all granted + + + + # [...] +