.travis.yml 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. language: php
  2. php:
  3. - 5.2
  4. - 5.3
  5. - 5.4
  6. env:
  7. - DB=mysql
  8. - DB=pgsql
  9. - DB=sqlite
  10. matrix:
  11. include:
  12. - php: 5.4
  13. env:
  14. - PHPCS=1
  15. before_script:
  16. - sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE cakephp_test;'; fi"
  17. - sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE cakephp_test2;'; fi"
  18. - sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE cakephp_test3;'; fi"
  19. - sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'CREATE DATABASE cakephp_test;' -U postgres; fi"
  20. - sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'CREATE SCHEMA test2;' -U postgres -d cakephp_test; fi"
  21. - sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'CREATE SCHEMA test3;' -U postgres -d cakephp_test; fi"
  22. - chmod -R 777 ./app/tmp
  23. - echo "var net = require('net');
  24. var server = net.createServer();
  25. server.listen(80, 'localhost');
  26. console.log('TCP server listening on port 80 at localhost.');" > app/tmp/socket.js
  27. - sudo node ./app/tmp/socket.js &
  28. - pear channel-discover pear.cakephp.org
  29. - pear install --alldeps cakephp/CakePHP_CodeSniffer
  30. - phpenv rehash
  31. - set +H
  32. - echo "<?php
  33. class DATABASE_CONFIG {
  34. private \$identities = array(
  35. 'mysql' => array(
  36. 'datasource' => 'Database/Mysql',
  37. 'host' => '0.0.0.0',
  38. 'login' => 'travis'
  39. ),
  40. 'pgsql' => array(
  41. 'datasource' => 'Database/Postgres',
  42. 'host' => '127.0.0.1',
  43. 'login' => 'postgres',
  44. 'database' => 'cakephp_test',
  45. 'schema' => array(
  46. 'default' => 'public',
  47. 'test' => 'public',
  48. 'test2' => 'test2',
  49. 'test_database_three' => 'test3'
  50. )
  51. ),
  52. 'sqlite' => array(
  53. 'datasource' => 'Database/Sqlite',
  54. 'database' => array(
  55. 'default' => ':memory:',
  56. 'test' => ':memory:',
  57. 'test2' => '/tmp/cakephp_test2.db',
  58. 'test_database_three' => '/tmp/cakephp_test3.db'
  59. ),
  60. )
  61. );
  62. public \$default = array(
  63. 'persistent' => false,
  64. 'host' => '',
  65. 'login' => '',
  66. 'password' => '',
  67. 'database' => 'cakephp_test',
  68. 'prefix' => ''
  69. );
  70. public \$test = array(
  71. 'persistent' => false,
  72. 'host' => '',
  73. 'login' => '',
  74. 'password' => '',
  75. 'database' => 'cakephp_test',
  76. 'prefix' => ''
  77. );
  78. public \$test2 = array(
  79. 'persistent' => false,
  80. 'host' => '',
  81. 'login' => '',
  82. 'password' => '',
  83. 'database' => 'cakephp_test2',
  84. 'prefix' => ''
  85. );
  86. public \$test_database_three = array(
  87. 'persistent' => false,
  88. 'host' => '',
  89. 'login' => '',
  90. 'password' => '',
  91. 'database' => 'cakephp_test3',
  92. 'prefix' => ''
  93. );
  94. public function __construct() {
  95. \$db = 'mysql';
  96. if (!empty(\$_SERVER['DB'])) {
  97. \$db = \$_SERVER['DB'];
  98. }
  99. foreach (array('default', 'test', 'test2', 'test_database_three') as \$source) {
  100. \$config = array_merge(\$this->{\$source}, \$this->identities[\$db]);
  101. if (is_array(\$config['database'])) {
  102. \$config['database'] = \$config['database'][\$source];
  103. }
  104. if (!empty(\$config['schema']) && is_array(\$config['schema'])) {
  105. \$config['schema'] = \$config['schema'][\$source];
  106. }
  107. \$this->{\$source} = \$config;
  108. }
  109. }
  110. }" > app/Config/database.php
  111. script:
  112. - sh -c "if [ '$PHPCS' != '1' ]; then ./lib/Cake/Console/cake test core AllTests --stderr; else phpcs -p --extensions=php --standard=CakePHP ./lib/Cake; fi"
  113. notifications:
  114. email: false