Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated 1.2 to support Symfony up to 2.7 #104

Merged
merged 1 commit into from
Mar 29, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ php: [5.3,5.4,5.5,5.6]
env:
- SF_VERSION='~2.3.0,>=2.3.19'
- SF_VERSION='~2.4.0,>=2.4.9'
- SF_VERSION='~2.5.0,>=2.5.3,<=2.5.4'
- SF_VERSION='~2.5.0,>=2.5.3'
- SF_VERSION='~2.6.0,>=2.6.2'

before_script:
- export WEB_FIXTURES_HOST=http://localhost/index.php
Expand Down
13 changes: 1 addition & 12 deletions Resources/public/js/constraints/False.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,4 @@
* @constructor
* @author dev.ymalcev@gmail.com
*/
function SymfonyComponentValidatorConstraintsFalse() {
this.message = '';

this.validate = function (value) {
var errors = [];
if ('' !== value && false !== value) {
errors.push(this.message.replace('{{ value }}', FpJsBaseConstraint.formatValue(value)));
}

return errors;
}
}
var SymfonyComponentValidatorConstraintsFalse = SymfonyComponentValidatorConstraintsIsFalse;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are just aliases. IsTrue/IsFalse/IsNull were added in favor of deprecated True/False/Null because of PHP7.

18 changes: 18 additions & 0 deletions Resources/public/js/constraints/IsFalse.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//noinspection JSUnusedGlobalSymbols
/**
* Checks if value is (bool) false
* @constructor
* @author dev.ymalcev@gmail.com
*/
function SymfonyComponentValidatorConstraintsIsFalse() {
this.message = '';

this.validate = function (value) {
var errors = [];
if ('' !== value && false !== value) {
errors.push(this.message.replace('{{ value }}', FpJsBaseConstraint.formatValue(value)));
}

return errors;
}
}
18 changes: 18 additions & 0 deletions Resources/public/js/constraints/IsNull.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//noinspection JSUnusedGlobalSymbols
/**
* Checks if value is null
* @constructor
* @author dev.ymalcev@gmail.com
*/
function SymfonyComponentValidatorConstraintsIsNull() {
this.message = '';

this.validate = function(value) {
var errors = [];
if (null !== value) {
errors.push(this.message.replace('{{ value }}', FpJsBaseConstraint.formatValue(value)));
}

return errors;
}
}
23 changes: 23 additions & 0 deletions Resources/public/js/constraints/IsTrue.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//noinspection JSUnusedGlobalSymbols
/**
* Checks if value is (bool) true
* @constructor
* @author dev.ymalcev@gmail.com
*/
function SymfonyComponentValidatorConstraintsIsTrue() {
this.message = '';

this.validate = function(value) {
if ('' === value) {
return [];
}

var errors = [];
if (true !== value) {
errors.push(this.message.replace('{{ value }}', FpJsBaseConstraint.formatValue(value)));
}

return errors;
}
}

13 changes: 1 addition & 12 deletions Resources/public/js/constraints/Null.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,4 @@
* @constructor
* @author dev.ymalcev@gmail.com
*/
function SymfonyComponentValidatorConstraintsNull() {
this.message = '';

this.validate = function(value) {
var errors = [];
if (null !== value) {
errors.push(this.message.replace('{{ value }}', FpJsBaseConstraint.formatValue(value)));
}

return errors;
}
}
var SymfonyComponentValidatorConstraintsNull = SymfonyComponentValidatorConstraintsIsNull;
18 changes: 1 addition & 17 deletions Resources/public/js/constraints/True.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,4 @@
* @constructor
* @author dev.ymalcev@gmail.com
*/
function SymfonyComponentValidatorConstraintsTrue() {
this.message = '';

this.validate = function(value) {
if ('' === value) {
return [];
}

var errors = [];
if (true !== value) {
errors.push(this.message.replace('{{ value }}', FpJsBaseConstraint.formatValue(value)));
}

return errors;
}
}

var SymfonyComponentValidatorConstraintsTrue = SymfonyComponentValidatorConstraintsIsTrue;
9 changes: 3 additions & 6 deletions Tests/BaseMinkTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,9 @@ protected function makeScreenshot()
}

try {
$name = date('Y-m-d_H:i:s') . '.png';
file_put_contents(
'/tmp/' . $name,
$this->session->getScreenshot()
);
$imageUrl = $this->getUploader()->upload('/tmp/' . $name);
$path = sprintf('%s/%s.png', sys_get_temp_dir(), date('Y-m-d_H-i-s'));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

":" cannot be a part of a filename on windows

file_put_contents($path, $this->session->getScreenshot());
$imageUrl = $this->getUploader()->upload($path);
} catch (\Exception $e) {
$imageUrl = $e->getMessage();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ public function isValidSingleChoice()
*/
public function isValidMultipleChoice()
{
return $this->_t_get(array('June', 'July'), array('June', 'May', 'September'));
return $this->_t_get(array('June', 'July'), array('June', 'May'));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Symfony stopped showing both error messages since 2.5.5. That's described in #83

So i kept only one invalid option and changed the last supported Symfony version of this branch to <2.7. Otherwise we could not support Symfony from 2.5.5 to <2.7 so easily.

}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
'isTypeScalar': function() { return _t.get(1, [1,2,3]); },
'isTypeString': function() { return _t.get('1', 1); },
'isValidSingleChoice': function() { return _t.get('male', 'wrong_choice'); },
'isValidMultipleChoice': function() { return _t.get(['June', 'July'], ['June', 'May', 'September']); },
'isValidMultipleChoice': function() { return _t.get(['June', 'July'], ['June', 'May']); },
'isMinMultipleChoice': function() { return _t.get(['June', 'July'], ['June']); },
'isMaxMultipleChoice': function() { return _t.get(['June'], ['June', 'July']); },

Expand Down
2 changes: 1 addition & 1 deletion Tests/app/Resources/BasicConstraintsEntity_sf_2_3.php
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ public function isValidSingleChoice()
*/
public function isValidMultipleChoice()
{
return $this->_t_get(array('June', 'July'), array('June', 'May', 'September'));
return $this->_t_get(array('June', 'July'), array('June', 'May'));
}

/**
Expand Down
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@

"require": {
"php": ">=5.3.2",
"symfony/form": ">=2.3,<=2.5.4",
"symfony/validator": "~2.3.0,>=2.3.19||~2.4.0,>=2.4.9||~2.5.0,>=2.5.3,<=2.5.4",
"symfony/symfony": "~2.3.0,>=2.3.19"
"symfony/form": ">=2.3,<2.7",
"symfony/validator": "~2.3.0,>=2.3.19||~2.4.0,>=2.4.9||>=2.5.3,<2.7",
"symfony/symfony": "~2.3.0,>=2.3.19||^2.4,<2.6||~2.6.2"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a bug in DI in Symfony 2.6.0 and 2.6.1

},

"require-dev": {
"doctrine/orm": ">=2.2.3",
"doctrine/doctrine-bundle": "~1.2",
"symfony/assetic-bundle": ">=2.3,<=2.5.4",
"symfony/assetic-bundle": "^2.3",
"phpunit/phpunit": "3.7.*",
"behat/mink-bundle": "dev-master",
"behat/mink-selenium2-driver": "1.1.0",
Expand All @@ -51,7 +51,7 @@

"extra": {
"branch-alias": {
"dev-master": "1.1-dev"
"dev-master": "1.2-dev"
}
}
}