-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix object builder tests for entities having fields of array, boolean, enum and LOB type.
- Loading branch information
1 parent
4ad2536
commit d03278e
Showing
48 changed files
with
1,324 additions
and
513 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,136 @@ | ||
language: php | ||
|
||
php: | ||
- 5.4 | ||
- 5.5 | ||
- 5.6 | ||
- hhvm | ||
- 7.0 | ||
- nightly | ||
|
||
env: | ||
- DB=agnostic #only database agnostic tests | ||
- DB=mysql DB_USER=root #only database tests against mysql | ||
- DB=pgsql DB_USER=postgres DB_NAME=postgres #only database tests against postgresql | ||
- DB=agnostic #only database agnostic tests | ||
- DB=mysql | ||
- DB=sqlite | ||
|
||
before_script: | ||
# Composer | ||
- wget http://getcomposer.org/composer.phar | ||
- php composer.phar install --prefer-source | ||
install: | ||
- rm -f ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini | ||
- composer install | ||
|
||
- if [ "$DB" != 'agnostic' ]; then ./tests/bin/setup.$DB.sh; fi # setup only for integration tests | ||
before_script: | ||
- if [[ $DB != 'agnostic' && $DB != 'sqlite' ]]; then ./tests/bin/setup.$DB.sh; fi | ||
|
||
script: | ||
- ./tests/bin/phpunit.$DB.sh; | ||
- ./vendor/bin/phpunit -v -c tests/$DB.phpunit.xml; | ||
|
||
|
||
matrix: | ||
fast_finish: true | ||
allow_failures: | ||
- php: hhvm | ||
include: | ||
- php: 5.5 | ||
env: DB=mysql MARIADB=5.5 | ||
addons: | ||
mariadb: 5.5 | ||
- php: 5.6 | ||
env: DB=mysql MARIADB=5.5 | ||
addons: | ||
mariadb: 5.5 | ||
- php: 7.0 | ||
env: DB=mysql MARIADB=5.5 | ||
addons: | ||
mariadb: 5.5 | ||
|
||
- php: 5.5 | ||
env: DB=mysql MARIADB=10.0 | ||
addons: | ||
mariadb: 10.0 | ||
- php: 5.6 | ||
env: DB=mysql MARIADB=10.0 | ||
addons: | ||
mariadb: 10.0 | ||
- php: 7.0 | ||
env: DB=mysql MARIADB=10.0 | ||
addons: | ||
mariadb: 10.0 | ||
|
||
# - php: 5.5 | ||
# env: DB=mysql MARIADB=10.1 | ||
# addons: | ||
# mariadb: 10.1 | ||
# - php: 5.6 | ||
# env: DB=mysql MARIADB=10.1 | ||
# addons: | ||
# mariadb: 10.1 | ||
# - php: 7.0 | ||
# env: DB=mysql MARIADB=10.1 | ||
# addons: | ||
# mariadb: 10.1 | ||
|
||
- php: 5.5 | ||
env: DB=pgsql POSTGRES=9.1 | ||
addons: | ||
postgresql: 9.1 | ||
- php: 5.6 | ||
env: DB=pgsql POSTGRES=9.1 | ||
addons: | ||
postgresql: 9.1 | ||
- php: 7.0 | ||
env: DB=pgsql POSTGRES=9.1 | ||
addons: | ||
postgresql: 9.1 | ||
|
||
- php: 5.5 | ||
env: DB=pgsql POSTGRES=9.2 | ||
addons: | ||
postgresql: 9.2 | ||
- php: 5.6 | ||
exclude: | ||
- php: hhvm | ||
env: DB=pgsql DB_USER=postgres DB_NAME=postgres # driver currently unsupported by HHVM | ||
- php: hhvm | ||
env: DB=sqlite # some issues at the moment | ||
|
||
#after_script: | ||
# - php vendor/bin/coveralls -v | ||
env: DB=pgsql POSTGRES=9.2 | ||
addons: | ||
postgresql: 9.2 | ||
- php: 7.0 | ||
env: DB=pgsql POSTGRES=9.2 | ||
addons: | ||
postgresql: 9.2 | ||
|
||
- php: 5.5 | ||
env: DB=pgsql POSTGRES=9.3 | ||
addons: | ||
postgresql: 9.3 | ||
- php: 5.6 | ||
env: DB=pgsql POSTGRES=9.3 | ||
addons: | ||
postgresql: 9.3 | ||
- php: 7.0 | ||
env: DB=pgsql POSTGRES=9.3 | ||
addons: | ||
postgresql: 9.3 | ||
|
||
- php: 5.5 | ||
env: DB=pgsql POSTGRES=9.4 | ||
addons: | ||
postgresql: 9.4 | ||
- php: 5.6 | ||
env: DB=pgsql POSTGRES=9.4 | ||
addons: | ||
postgresql: 9.4 | ||
- php: 7.0 | ||
env: DB=pgsql POSTGRES=9.4 | ||
addons: | ||
postgresql: 9.4 | ||
|
||
allow_failures: | ||
- php: nightly | ||
|
||
fast_finish: true | ||
|
||
# cache vendors | ||
cache: | ||
directories: | ||
- vendor | ||
- $HOME/.composer/cache | ||
|
||
# This triggers builds to run on the new TravisCI infrastructure. | ||
# See: http://docs.travis-ci.com/user/workers/container-based-infrastructure/ | ||
sudo: false | ||
|
||
notifications: | ||
webhooks: | ||
- http://propel.jarves.io/build.php | ||
- https://webhooks.gitter.im/e/206efe76e183f9ade489 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
src/Propel/Generator/Builder/Om/Component/ActiveRecordTrait/BooleanAccessorMethods.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
/** | ||
* This file is part of the Propel package. | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @license MIT License | ||
*/ | ||
|
||
namespace Propel\Generator\Builder\Om\Component\ActiveRecordTrait; | ||
|
||
use Propel\Generator\Builder\Om\Component\BuildComponent; | ||
use Propel\Generator\Model\Field; | ||
|
||
/** | ||
* Add boolean accessors (`isXxx` or `hasXxx`) to ActiveRecord trait. | ||
* | ||
* @author Cristiano Cinotti <cristianocinotti@gmail.com> | ||
* @package Propel\Generator\Builder\Om\Component\ActiveRecordTrait | ||
*/ | ||
class BooleanAccessorMethods extends BuildComponent | ||
{ | ||
public function process() | ||
{ | ||
foreach ($this->getBuilder()->getEntity()->getFields() as $field) { | ||
if ($field->isBooleanType()) { | ||
$this->addMethod($this->getBooleanAccessorName($field), $field->getAccessorVisibility()) | ||
->setDescription("Get the value of `{$field->getName()}` field") | ||
->setType('bool') | ||
->setBody("return \$this->{$field->getName()};") | ||
; | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* Returns the name to be used as boolean accessor name | ||
* | ||
* @param Field $field | ||
* @return string | ||
*/ | ||
protected function getBooleanAccessorName(Field $field) | ||
{ | ||
$name = $field->getCamelCaseName(); | ||
if (!preg_match('/^(?:is|has)(?=[A-Z])/', $name)) { | ||
$name = 'is' . ucfirst($name); | ||
} | ||
return $name; | ||
} | ||
} |
Oops, something went wrong.