Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

gocanto's avatar
Level 54

Travis File

Hey there,

How can a set my travis file to install a mysql database for testing a run them?

I am having these errors

Worker information
hostname: i-0525463-precise-production-2-worker-org-docker.travisci.net:db8574dd-f73d-48c0-91ad-e91e5091b2ef
version: v2.5.0 https://github.com/travis-ci/worker/tree/da3a43228dffc0fcca5a46569ca786b22991979f
instance: 598f2a1:travis:php
startup: 538.545706ms
system_info
Build system information
Build language: php
Build group: stable
Build dist: precise
Build id: 209629988
Job id: 209629989
travis-build version: 9ebe7468d
Build image provisioning date and time
Thu Feb  5 15:09:33 UTC 2015
Operating System Details
Distributor ID: Ubuntu
Description:    Ubuntu 12.04.5 LTS
Release:    12.04
Codename:   precise
Linux Version
3.13.0-29-generic
Cookbooks Version
a68419e https://github.com/travis-ci/travis-cookbooks/tree/a68419e
GCC version
gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
LLVM version
clang version 3.4 (tags/RELEASE_34/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
Pre-installed Ruby versions
ruby-1.9.3-p551
Pre-installed Node.js versions
v0.10.36
Pre-installed Go versions
1.4.1
Redis version
redis-server 2.8.19
riak version
2.0.2
MongoDB version
MongoDB 2.4.12
CouchDB version
couchdb 1.6.1
Neo4j version
1.9.4
RabbitMQ Version
3.4.3
ElasticSearch version
1.4.0
Installed Sphinx versions
2.0.10
2.1.9
2.2.6
Default Sphinx version
2.2.6
Installed Firefox version
firefox 31.0esr
PhantomJS version
1.9.8
ant -version
Apache Ant(TM) version 1.8.2 compiled on December 3 2011
mvn -version
Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T17:29:23+00:00)
Maven home: /usr/local/maven
Java version: 1.7.0_76, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-oracle/jre
Default locale: en_US, platform encoding: ANSI_X3.4-1968
OS name: "linux", version: "3.13.0-29-generic", arch: "amd64", family: "unix"
fix.CVE-2015-7547
$ export DEBIAN_FRONTEND=noninteractive
Reading package lists...
Building dependency tree...
Reading state information...
The following extra packages will be installed:
  libc-bin libc-dev-bin libc6-dev
Suggested packages:
  glibc-doc
The following packages will be upgraded:
  libc-bin libc-dev-bin libc6 libc6-dev
4 upgraded, 0 newly installed, 0 to remove and 262 not upgraded.
Need to get 8,840 kB of archives.
After this operation, 14.3 kB disk space will be freed.
Get:1 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main libc6-dev amd64 2.15-0ubuntu10.15 [2,943 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main libc-dev-bin amd64 2.15-0ubuntu10.15 [84.7 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main libc-bin amd64 2.15-0ubuntu10.15 [1,177 kB]
Get:4 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main libc6 amd64 2.15-0ubuntu10.15 [4,636 kB]
Fetched 8,840 kB in 0s (25.8 MB/s)
Preconfiguring packages ...
(Reading database ... 70845 files and directories currently installed.)
Preparing to replace libc6-dev 2.15-0ubuntu10.10 (using .../libc6-dev_2.15-0ubuntu10.15_amd64.deb) ...
Unpacking replacement libc6-dev ...
Preparing to replace libc-dev-bin 2.15-0ubuntu10.10 (using .../libc-dev-bin_2.15-0ubuntu10.15_amd64.deb) ...
Unpacking replacement libc-dev-bin ...
Preparing to replace libc-bin 2.15-0ubuntu10.10 (using .../libc-bin_2.15-0ubuntu10.15_amd64.deb) ...
Unpacking replacement libc-bin ...
Processing triggers for man-db ...
Setting up libc-bin (2.15-0ubuntu10.15) ...
(Reading database ... 70844 files and directories currently installed.)
Preparing to replace libc6 2.15-0ubuntu10.10 (using .../libc6_2.15-0ubuntu10.15_amd64.deb) ...
Unpacking replacement libc6 ...
Setting up libc6 (2.15-0ubuntu10.15) ...
Setting up libc-dev-bin (2.15-0ubuntu10.15) ...
Setting up libc6-dev (2.15-0ubuntu10.15) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
git.checkout
0.37s$ git clone --depth=50 --branch=master https://github.com/ant-vel/Shop.git ant-vel/Shop
Cloning into 'ant-vel/Shop'...
remote: Counting objects: 489, done.
remote: Compressing objects: 100% (116/116), done.
remote: Total 489 (delta 50), reused 0 (delta 0), pack-reused 369
Receiving objects: 100% (489/489), 109.39 KiB | 0 bytes/s, done.
Resolving deltas: 100% (198/198), done.
Checking connectivity... done.
$ cd ant-vel/Shop
$ git checkout -qf 8d1b97a902d26384b30d27f5f00fab898cbf3463
services
0.02s$ sudo service mysql start
start: Job is already running: mysql
This job is running on container-based infrastructure, which does not allow use of 'sudo', setuid and setguid executables.
If you require sudo, add 'sudo: required' to your .travis.yml
See https://docs.travis-ci.com/user/workers/container-based-infrastructure/ for details.
0.02s$ phpenv global 7.0 2>/dev/null
7.0 is not pre-installed; installing
Downloading archive: https://s3.amazonaws.com/travis-php-archives/binaries/ubuntu/12.04/x86_64/php-7.0.tar.bz2
8.84s$ curl -s -o archive.tar.bz2 $archive_url && tar xjf archive.tar.bz2 --directory /
0.01s
0.03s$ phpenv global 7.0
2.21s$ composer self-update 1.0.0
Updating to version 1.0.0 (stable channel).
   Downloading (connecting...)Downloading (100%)
Use composer self-update --rollback to return to version 1.4.0
2.19s$ composer self-update
You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug
Updating to version 1.4.0.
    Downloading: Connecting...    Downloading: 100%
Use composer self-update --rollback to return to version 1.0.0
$ php --version
PHP 7.0.16 (cli) (built: Mar  9 2017 02:08:06) ( ZTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.16, Copyright (c) 1999-2017, by Zend Technologies
    with Xdebug v2.5.0, Copyright (c) 2002-2016, by Derick Rethans
$ composer --version
Composer version 1.4.0 2017-03-08 17:51:24
before_install.1
0.04s$ if [[ $TRAVIS_PHP_VERSION != 7.1 ]] ; then phpenv config-rm xdebug.ini; fi
File xdebug.ini removed from /home/travis/.phpenv/versions/7.0/etc/conf.d.
before_install.2
0.02s$ mysql -e 'CREATE DATABASE IF NOT EXISTS test;'
install
9.48s$ travis_retry composer install --no-interaction --prefer-dist --no-suggest
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 63 installs, 0 updates, 0 removals
  - Installing symfony/polyfill-mbstring (dev-master 53ad9fa): Downloading (100%)
  - Installing symfony/translation (dev-master 7f401e7): Downloading (100%)
  - Installing nesbot/carbon (dev-master 7a02699): Downloading (connDownloading (100%)
  - Installing nikic/php-parser (2.x-dev 4dd659e): Downloading (100%)
  - Installing classpreloader/classpreloader (dev-master bc7206a): Downloading (100%)
  - Installing doctrine/inflector (dev-master 803a2ed): Downloading (100%)
  - Installing doctrine/instantiator (dev-master 416fb8a): Downloading (100%)
  - Installing fzaninotto/faker (dev-master 409c90a): DowDownloading (80%)Downloading (100%)
  - Installing hamcrest/hamcrest-php (dev-master b7a5e18): Downloading (100%)
  - Installing jakub-onderka/php-console-color (0.1): Downloading (100%)
  - Installing symfony/polyfill-util (dev-master ef830ce): DownloadDownloading (100%)
  - Installing symfony/polyfill-php56 (dev-master 3dd0fbb): Downloading (connecting...)Downloading (100%)
  - Installing jeremeamia/superclosure (dev-master 2b33831): Downloading (100%)
  - Installing vlucas/phpdotenv (dev-master 3cc116a): Downloading (100%)
  - Installing symfony/var-dumper (dev-master c4ff00b): Downloading (100%)
  - Installing symfony/routing (dev-master 75a1dee): DownloadDownloading (100%)
  - Installing symfony/process (dev-master fbaacdf): Downloading (connecting...)Downloading (100%)
  - Installing symfony/http-foundation (dev-master 71abaf8): Downloading (100%)
  - Installing symfony/event-dispatcher (dev-master e8f47a3): Downloading (Downloading (100%)
  - Installing psr/log (dev-master 4ebe3a8): Downloading (100%)
  - Installing symfony/debug (dev-master 61de488): Downloading (100%)
  - Installing symfony/http-kernel (dev-master 988103f): Downloading (connecting...)Downloading (100%)
  - Installing symfony/finder (dev-master df68238): Downloading (Downloading (100%)
  - Installing symfony/console (dev-master 72fafa7): Downloading (100%)
  - Installing swiftmailer/swiftmailer (5.x-dev a6d3097): Downloading (Downloading (65%)Downloading (100%)
  - Installing paragonie/random_compat (v2.0.3): Downloading (100%)
  - Installing ramsey/uuid (dev-master 2d19c68): Downloading (100%)
  - Installing jakub-onderka/php-console-highlighter (v0.3.2): Downloading (100%)
  - Installing dnoegel/php-xdg-base-dir (0.1): Downloading (0%)      Downloading (100%)
  - Installing psy/psysh (v0.7.2): Downloading (connecting...)Downloading (100%)
  - Installing mtdowling/cron-expression (v1.1.0): Downloading (100%)
  - Installing monolog/monolog (1.x-dev 214b8ef): DownloadingDownloading (100%)
  - Installing league/flysystem (dev-master 63c877e): Downloading (100%)
  - Installing laravel/framework (dev-master 2ac250b): Downloading (connecting...)Downloading (100%)
  - Installing mockery/mockery (dev-master 900faf0): Downloading (Downloading (100%)
  - Installing orchestra/database (dev-master fa20620): Downloading (100%)
  - Installing symfony/dom-crawler (3.1.x-dev 59eee3c): Downloading (connecting...)Downloading (100%)
  - Installing symfony/css-selector (3.1.x-dev ca809c6): Downloading (100%)
  - Installing orchestra/testbench (dev-master 14ce564): Downloading (100%)
  - Installing phpdocumentor/reflection-common (dev-master 144c307): DownloaDownloading (100%)
  - Installing phpdocumentor/type-resolver (0.2): Downloading (connecting...)Downloading (100%)
  - Installing sebastian/recursion-context (dev-master b19cc32): Downloading (100%)
  - Installing sebastian/exporter (dev-master 7dfcd24): Downloading (100%)
  - Installing sebastian/diff (dev-master d081431): Downloading (100%)
  - Installing sebastian/comparator (dev-master 21400bd): DowDownloading (100%)
  - Installing webmozart/assert (dev-master c0c9208): Downloading (100%)
  - Installing phpdocumentor/reflection-docblock (3.1.1): Downloading (100%)
  - Installing phpspec/prophecy (dev-master 5c324f4): Downloading (Downloading (100%)
  - Installing sebastian/version (dev-master 99732be): Downloading (connecting...)Downloading (100%)
  - Installing sebastian/environment (dev-master 8456202): Downloading (100%)
  - Installing sebastian/code-unit-reverse-lookup (dev-master 0a16efa): Downloading (100%)
  - Installing phpunit/php-token-stream (dev-master 2ef59c5): Downloading (100%)
  - Installing phpunit/php-text-template (1.2.1): Downloading (connecting...)Downloading (100%)
  - Installing phpunit/php-file-iterator (dev-master 3cc8f69): Downloading (100%)
  - Installing phpunit/php-code-coverage (dev-master 8ca687f): Downloading (100%)
  - Installing symfony/yaml (dev-master 3d42c56): DownloDownloading (100%)
  - Installing sebastian/resource-operations (dev-master fadc83f): Downloading (connecting...)Downloading (100%)
  - Installing sebastian/object-enumerator (dev-master 1a7e888): Downloading (100%)
  - Installing sebastian/global-state (1.1.1): Downloading (100%)
  - Installing phpunit/phpunit-mock-objects (3.4.0): Downloading (85Downloading (100%)
  - Installing phpunit/php-timer (1.0.8): Downloading (connecting...)Downloading (100%)
  - Installing myclabs/deep-copy (1.5.4): Downloading (100%)
  - Installing phpunit/phpunit (5.7.x-dev c4d334a): Downloading (100%)
Generating autoload files
0.85s$ vendor/bin/phpunit --verbose
PHPUnit 5.7-dev by Sebastian Bergmann and contributors.
Runtime:       PHP 7.0.16
Configuration: /home/travis/build/ant-vel/Shop/phpunit.xml
EE                                                                  2 / 2 (100%)
Time: 760 ms, Memory: 12.00MB
There were 2 errors:
1) Antvel\Tests\Customers\BusinessesTest::test_create_a_new_business_in_databse
InvalidArgumentException: Database [test] not configured.
/home/travis/build/ant-vel/Shop/vendor/laravel/framework/src/Illuminate/Database/DatabaseManager.php:239
/home/travis/build/ant-vel/Shop/vendor/laravel/framework/src/Illuminate/Database/DatabaseManager.php:158
/home/travis/build/ant-vel/Shop/vendor/laravel/framework/src/Illuminate/Database/DatabaseManager.php:68
/home/travis/build/ant-vel/Shop/vendor/laravel/framework/src/Illuminate/Database/Migrations/DatabaseMigrationRepository.php:186
/home/travis/build/ant-vel/Shop/vendor/laravel/framework/src/Illuminate/Database/Migrations/DatabaseMigrationRepository.php:154
/home/travis/build/ant-vel/Shop/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php:496
/home/travis/build/ant-vel/Shop/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/ResetCommand.php:63
/home/travis/build/ant-vel/Shop/vendor/laravel/framework/src/Illuminate/Container/Container.php:508
/home/travis/build/ant-vel/Shop/vendor/laravel/framework/src/Illuminate/Console/Command.php:169
/home/travis/build/ant-vel/Shop/vendor/symfony/console/Command/Command.php:257
/home/travis/build/ant-vel/Shop/vendor/laravel/framework/src/Illuminate/Console/Command.php:155
/home/travis/build/ant-vel/Shop/vendor/laravel/framework/src/Illuminate/Console/Command.php:185
/home/travis/build/ant-vel/Shop/vendor/orchestra/database/Console/Migrations/RefreshCommand.php:28
/home/travis/build/ant-vel/Shop/vendor/laravel/framework/src/Illuminate/Container/Container.php:508
/home/travis/build/ant-vel/Shop/vendor/laravel/framework/src/Illuminate/Console/Command.php:169
/home/travis/build/ant-vel/Shop/vendor/symfony/console/Command/Command.php:257
/home/travis/build/ant-vel/Shop/vendor/laravel/framework/src/Illuminate/Console/Command.php:155
/home/travis/build/ant-vel/Shop/vendor/symfony/console/Application.php:829
/home/travis/build/ant-vel/Shop/vendor/symfony/console/Application.php:191
/home/travis/build/ant-vel/Shop/vendor/symfony/console/Application.php:122
/home/travis/build/ant-vel/Shop/vendor/laravel/framework/src/Illuminate/Console/Application.php:64
/home/travis/build/ant-vel/Shop/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:218
/home/travis/build/ant-vel/Shop/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:237
/home/travis/build/ant-vel/Shop/tests/Traits/Environment.php:25
/home/travis/build/ant-vel/Shop/tests/TestCase.php:49
2) Antvel\Tests\Customers\PeopleTest::test_create_a_new_person_in_databse
InvalidArgumentException: Database [test] not configured.
/home/travis/build/ant-vel/Shop/vendor/laravel/framework/src/Illuminate/Database/DatabaseManager.php:239
/home/travis/build/ant-vel/Shop/vendor/laravel/framework/src/Illuminate/Database/DatabaseManager.php:158
/home/travis/build/ant-vel/Shop/vendor/laravel/framework/src/Illuminate/Database/DatabaseManager.php:68
/home/travis/build/ant-vel/Shop/vendor/laravel/framework/src/Illuminate/Database/Migrations/DatabaseMigrationRepository.php:186
/home/travis/build/ant-vel/Shop/vendor/laravel/framework/src/Illuminate/Database/Migrations/DatabaseMigrationRepository.php:154
/home/travis/build/ant-vel/Shop/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php:496
/home/travis/build/ant-vel/Shop/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/ResetCommand.php:63
/home/travis/build/ant-vel/Shop/vendor/laravel/framework/src/Illuminate/Container/Container.php:508
/home/travis/build/ant-vel/Shop/vendor/laravel/framework/src/Illuminate/Console/Command.php:169
/home/travis/build/ant-vel/Shop/vendor/symfony/console/Command/Command.php:257
/home/travis/build/ant-vel/Shop/vendor/laravel/framework/src/Illuminate/Console/Command.php:155
/home/travis/build/ant-vel/Shop/vendor/laravel/framework/src/Illuminate/Console/Command.php:185
/home/travis/build/ant-vel/Shop/vendor/orchestra/database/Console/Migrations/RefreshCommand.php:28
/home/travis/build/ant-vel/Shop/vendor/laravel/framework/src/Illuminate/Container/Container.php:508
/home/travis/build/ant-vel/Shop/vendor/laravel/framework/src/Illuminate/Console/Command.php:169
/home/travis/build/ant-vel/Shop/vendor/symfony/console/Command/Command.php:257
/home/travis/build/ant-vel/Shop/vendor/laravel/framework/src/Illuminate/Console/Command.php:155
/home/travis/build/ant-vel/Shop/vendor/symfony/console/Application.php:829
/home/travis/build/ant-vel/Shop/vendor/symfony/console/Application.php:191
/home/travis/build/ant-vel/Shop/vendor/symfony/console/Application.php:122
/home/travis/build/ant-vel/Shop/vendor/laravel/framework/src/Illuminate/Console/Application.php:64
/home/travis/build/ant-vel/Shop/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:218
/home/travis/build/ant-vel/Shop/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:237
/home/travis/build/ant-vel/Shop/tests/Traits/Environment.php:25
/home/travis/build/ant-vel/Shop/tests/TestCase.php:49
ERRORS!
Tests: 2, Assertions: 0, Errors: 2.
The command "vendor/bin/phpunit --verbose" exited with 2.
Done. Your build exited with 1.

This is how I am doing it

https://github.com/ant-vel/Shop/blob/master/.travis.yml

Thanks.

0 likes
0 replies

Please or to participate in this conversation.