Skip to content
This repository
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 120 lines (114 sloc) 3.588 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
language: php

php:
  - 5.2
  - 5.3
  - 5.4

env:
  - DB=mysql
  - DB=pgsql
  - DB=sqlite

matrix:
  include:
    - php: 5.4
      env:
        - PHPCS=1

before_script:
  - sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE cakephp_test;'; fi"
  - sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE cakephp_test2;'; fi"
  - sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE cakephp_test3;'; fi"
  - sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'CREATE DATABASE cakephp_test;' -U postgres; fi"
  - sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'CREATE SCHEMA test2;' -U postgres -d cakephp_test; fi"
  - sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'CREATE SCHEMA test3;' -U postgres -d cakephp_test; fi"
  - chmod -R 777 ./app/tmp
  - echo "var net = require('net');
    var server = net.createServer();
    server.listen(80, 'localhost');
    console.log('TCP server listening on port 80 at localhost.');" > app/tmp/socket.js
  - sudo node ./app/tmp/socket.js &
  - pear channel-discover pear.cakephp.org
  - pear install --alldeps cakephp/CakePHP_CodeSniffer
  - phpenv rehash
  - set +H
  - echo "<?php
    class DATABASE_CONFIG {
    private \$identities = array(
      'mysql' => array(
        'datasource' => 'Database/Mysql',
        'host' => '0.0.0.0',
        'login' => 'travis'
      ),
      'pgsql' => array(
        'datasource' => 'Database/Postgres',
        'host' => '127.0.0.1',
        'login' => 'postgres',
        'database' => 'cakephp_test',
        'schema' => array(
          'default' => 'public',
          'test' => 'public',
          'test2' => 'test2',
          'test_database_three' => 'test3'
        )
      ),
      'sqlite' => array(
        'datasource' => 'Database/Sqlite',
        'database' => array(
          'default' => ':memory:',
          'test' => ':memory:',
          'test2' => '/tmp/cakephp_test2.db',
          'test_database_three' => '/tmp/cakephp_test3.db'
        ),
      )
    );
    public \$default = array(
      'persistent' => false,
      'host' => '',
      'login' => '',
      'password' => '',
      'database' => 'cakephp_test',
      'prefix' => ''
    );
    public \$test = array(
      'persistent' => false,
      'host' => '',
      'login' => '',
      'password' => '',
      'database' => 'cakephp_test',
      'prefix' => ''
    );
    public \$test2 = array(
      'persistent' => false,
      'host' => '',
      'login' => '',
      'password' => '',
      'database' => 'cakephp_test2',
      'prefix' => ''
    );
    public \$test_database_three = array(
      'persistent' => false,
      'host' => '',
      'login' => '',
      'password' => '',
      'database' => 'cakephp_test3',
      'prefix' => ''
    );
    public function __construct() {
      \$db = 'mysql';
      if (!empty(\$_SERVER['DB'])) {
        \$db = \$_SERVER['DB'];
      }
      foreach (array('default', 'test', 'test2', 'test_database_three') as \$source) {
        \$config = array_merge(\$this->{\$source}, \$this->identities[\$db]);
        if (is_array(\$config['database'])) {
          \$config['database'] = \$config['database'][\$source];
        }
        if (!empty(\$config['schema']) && is_array(\$config['schema'])) {
          \$config['schema'] = \$config['schema'][\$source];
        }
        \$this->{\$source} = \$config;
      }
    }
    }" > app/Config/database.php

script:
  - sh -c "if [ '$PHPCS' != '1' ]; then ./lib/Cake/Console/cake test core AllTests --stderr; else phpcs -p --extensions=php --standard=CakePHP ./lib/Cake; fi"

notifications:
  email: false
Something went wrong with that request. Please try again.