language: php

php:
  - 5.3
  - 5.4

env:
  - CAKE_VERSION=2.1.3

before_script:
  - git clone --depth 1 git://github.com/cakephp/cakephp ../cakephp && cd ../cakephp && git checkout $CAKE_VERSION
  - cp -R ../chosen-cakephp plugins/Chosen
  - chmod -R 777 ../cakephp/app/tmp
  - set +H

script:
  - ./lib/Cake/Console/cake test Chosen View/Helper/ChosenHelper --stderr
language: php

php:
  - 5.3
  - 5.4

env:
  - CAKE_VERSION=2.1.3

before_script:
  - git clone --depth 1 git://github.com/cakephp/cakephp ../cakephp && cd ../cakephp && git checkout $CAKE_VERSION
  - mysql -e 'CREATE DATABASE cakephp_test;'
  - cp -R ../chosen-cakephp plugins/Chosen
  - chmod -R 777 ../cakephp/app/tmp
  - 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'
          )
        )
      );
      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 function __construct() {
        \$db = 'mysql';
        if (!empty(\$_SERVER['DB'])) {
          \$db = \$_SERVER['DB'];
        }
        foreach (array('default', 'test') 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;
        }
      }
      }" > ../cakephp/app/Config/database.php
script:
  - ./lib/Cake/Console/cake test Chosen View/Helper/ChosenHelper --stderr
Create test database and database.php file
Create test database and database.php file
