Commit Graph

1723 Commits

Author SHA1 Message Date
Joseph Bielawski
4c44023e8b [Tests] Skip segfaulting form test 2011-12-30 15:36:55 +01:00
Olivier Dolbeau
0d3e709e0e Rename test file 2011-12-29 16:30:31 +01:00
Bart van den Burg
ced57d8ee5 reverse transform doesn't take a second argument 2011-12-29 09:10:04 +01:00
Fabien Potencier
a01eee8536 merged branch ericclemmons/2884-parameterbag-with-spaces (PR #2976)
Commits
-------

85ca8e3 ParameterBag no longer resolves parameters that have spaces.
99011ca Added tests for ParameterBag parameters with spaces

Discussion
----------

[DependencyInjection] Parameters with spaces are not resolved

Bug fix: yes
Feature addition: no
Backwards compatibility break: no (not likely, according to convention)
Symfony2 tests pass: yes
Fixes the following tickets: #2884

`ParameterBag` currently resolves anything between two `%` signs, which creates issues for any parameters in the DIC that are legitimate text.  This PR enforces the [documented parameter convention](http://symfony.com/doc/2.0/book/service_container.html#service-parameters) so that only `%parameters.with.no_spaces%` are resolved.

I was considering using instead `^%([^\w\._-]+)%$`, but felt that was too constricting & could easily introduce issues with existing applications.
2011-12-28 21:36:04 +01:00
Javier Eguíluz
3f2e1b0483 [Console] Updated tests to reflect the change from program to application 2011-12-28 12:44:00 +01:00
Eric Clemmons
99011ca9c9 Added tests for ParameterBag parameters with spaces 2011-12-27 12:48:49 -08:00
Kris Wallsmith
1b4aaa2c8e [HttpFoundation] fixed ApacheRequest
Pathinfo was incorrect when using mod_rewrite.
Added better test coverage.
2011-12-21 13:57:56 -08:00
Fabien Potencier
3dd1072edc [HttpKernel] fixed unit tests that can fail randomly 2011-12-20 20:21:56 +01:00
Fabien Potencier
ebc9979a57 [Process] fixed unit tests on PHP 5.4 2011-12-20 20:16:11 +01:00
Christophe Coevoet
29f4111f3e [DoctrineBridge] Added a failing test showing the issue for proxy users 2011-12-19 18:31:29 +01:00
Fabien Potencier
4316595dbb fixed CS 2011-12-18 14:42:59 +01:00
Joseph Bielawski
5c41ec9e4f [HttpKernel][Client] Only simple (name=value without any other params) cookies can be stored in same line, so lets add every as standalone to be compliant with rfc6265 2011-12-15 11:35:58 +01:00
Jeremy Mikola
d5a1343c29 [Console] Improve input definition output for Boolean defaults
Previously, Boolean defaults were printed as strings, which lead to true and false being printed as "1" and "", respectively. With this change, they are now printed as "true" and "false".
2011-12-15 01:07:36 -05:00
Fabien Potencier
9641c55d16 merged branch RapotOR/2.0-PR2504-squashed (PR #2868)
Commits
-------

4d64d90 Allow empty result; change default *choices* value to **null** instead of **array()**. - added *testEmptyChoicesAreManaged* test - `null` as default value for choices. - is_array() used to test if choices are user-defined. - `null` as default value in __construct too. - `null` as default value for choices in EntityType.

Discussion
----------

[Doctrine][Bridge] EntityType: Allow empty result; default `choices` value changed to null

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
References the following tickets: #2504

- added *testEmptyChoicesAreManaged* test
- `null` as default value for choices.
-  is_array() used to test if choices are user-defined.
- `null` as default value in __construct too.
- `null` as default value for choices in EntityType.

I squashed commits from PR #2504 as requested.
2011-12-13 22:28:46 +01:00
Cédric Lahouste
4d64d90f13 Allow empty result; change default *choices* value to **null** instead of **array()**.
- added *testEmptyChoicesAreManaged* test
- `null` as default value for choices.
- is_array() used to test if choices are user-defined.
- `null` as default value in __construct too.
- `null` as default value for choices in EntityType.
2011-12-13 18:12:20 +01:00
Bart van den Burg
d97d7e93c0 Added a check to see if the type is a string if it's not a FormTypeInterface 2011-12-13 12:27:51 +01:00
Fabien Potencier
e3421a0b1d [DoctrineBridge] fixed some CS 2011-12-13 10:22:12 +01:00
Christophe Coevoet
9c1fbb884f [DoctrineBridge] fixed the refreshing of the user for invalid users 2011-12-12 13:36:19 +01:00
Bart van den Burg
171f2d5090 fixed failing test in windows because
1) PHP_BINDIR is not secure to rely on
2) the assertion doesn't actually check for the suffix as the test implies
2011-12-11 19:56:03 +01:00
Fabien Potencier
e9ddd39b71 merged branch lsmith77/serializer_tests (PR #2838)
Commits
-------

b1ca0cd added several tests to the serializer (mainly for deserialization)

Discussion
----------

Serializer tests

Bug fix: no
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: [![Build Status](https://secure.travis-ci.org/lsmith77/symfony.png?branch=serializer_tests)](http://travis-ci.org/lsmith77/symfony)
Fixes the following tickets: -

The state of the serializer tests wasn't as bad as I thought.
Was mostly missing tests for some edge cases as well as deserialization.

Once this is merged to 2.0 and master, I will rebase #2530 and make sure the tests still pass.
2011-12-11 18:42:31 +01:00
Fabien Potencier
c74f5f245c merged branch stealth35/fix_2735 (PR #2760)
Commits
-------

3759ff0 [Locale] StubNumberFormatter allow to parse 64bit number in 64bit mode

Discussion
----------

[Locale] StubNumberFormatter allow to parse 64bit number in 64bit mode

Bug fix: yes
Feature addition: yes
Backwards compatibility break: no
Symfony2 tests pass: [![Build Status](https://secure.travis-ci.org/stealth35/symfony.png?branch=fix_2735)](http://travis-ci.org/stealth35/symfony)
Fixes the following tickets: #2735

---------------------------------------------------------------------------

by stealth35 at 2011/12/01 06:47:32 -0800

@Seldaek should be better now

---------------------------------------------------------------------------

by stealth35 at 2011/12/02 04:22:42 -0800

@fabpot done

---------------------------------------------------------------------------

by fabpot at 2011/12/02 04:28:24 -0800

Tests do not pas for me (on a Mac):

    1) Symfony\Tests\Component\Locale\Stub\StubNumberFormatterTest::testParseTypeInt64StubWith64BitIntegerInPhp64Bit
    ->parse() TYPE_INT64 does not use true 64 bit integers, using only the 32 bit range.
    Failed asserting that 2147483648 matches expected -2147483648.

    .../tests/Symfony/Tests/Component/Locale/Stub/StubNumberFormatterTest.php:819

---------------------------------------------------------------------------

by stealth35 at 2011/12/02 04:50:20 -0800

@fabpot, could you send me the return of this code

``` php
<?php
$formatter = new \NumberFormatter('en', \NumberFormatter::DECIMAL);

$value = $formatter->parse('2,147,483,648', \NumberFormatter::TYPE_INT64);
var_dump($value);

$value = $formatter->parse('-2,147,483,649', \NumberFormatter::TYPE_INT64);
var_dump($value);
```

---------------------------------------------------------------------------

by fabpot at 2011/12/02 06:06:21 -0800

    int(-2147483648)
    int(2147483647)

---------------------------------------------------------------------------

by stealth35 at 2011/12/02 06:10:28 -0800

It's nosens, but the Stub should follow Intl ... so I fix that

---------------------------------------------------------------------------

by stealth35 at 2011/12/11 08:48:25 -0800

It's OK now
2011-12-11 18:40:34 +01:00
stealth35
3759ff0777 [Locale] StubNumberFormatter allow to parse 64bit number in 64bit mode 2011-12-11 17:45:39 +01:00
lsmith77
b1ca0cdfe9 added several tests to the serializer (mainly for deserialization) 2011-12-11 12:09:53 +01:00
Fabien Potencier
c22652f5d7 merged branch aboks/doctrine_data_collector (PR #2733)
Commits
-------

bb0d202 Switched sanitizeParameter() for existing varToString()-method; now always stores a string representation of each parameter
4fe4dfd Fixed vendor version mismatch in tests
28730e9 [DoctrineBridge] Added unit tests
4535abe [DoctrineBridge] Fixed attempt to serialize non-serializable values

Discussion
----------

[DoctrineBridge] Fixed attempt to serialize non-serializable values

Bug fix: yes
Feature addition: no
Backwards compatibility break: no (99%)
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -

The Doctrine DBAL type system does not pose any restrictions on the php-types of parameters in queries. Hence one could write a doctrine-type that uses a resource or an `\SplFileInfo` as its corresponding php-type. Parameters of these types are logged in the `DoctrineDataCollector` however, which is then serialized in the profiler. Since resources or `\SplFileInfo` variables cannot be serialized this throws an exception.

This PR fixes this problem (for known cases) by sanitizing the query parameters to only contain serializable types. The `isNotSerializable`-check surely is not complete yet, but more non-serializable classes can be added on a case-by-case basis.

---------------------------------------------------------------------------

by fabpot at 2011/12/07 07:04:43 -0800

Tests do not pass for me.

Furthermore, let's reuse what we already have in the framework (see https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpKernel/HttpKernel.php#L187 -- yes you can just copy/paster the existing code).

---------------------------------------------------------------------------

by aboks at 2011/12/09 01:41:14 -0800

@fabpot I fixed the tests (seems I had the wrong vendor versions in my copy) and reused the `varToString()`-code. This introduces a tiny BC break in the rare case that someone writes his own templates for the web profiler (the parameters returned by the data collector are now always a string; could be any type before).

After merging this PR, merging 2.0 into master would give a merge conflict and failing tests (because of the changes related to the introduction of the `ManagerRegistry` interface). To prevent this, please merge #2820 into master directly after merging this PR (so before merging 2.0 into master). After that 2.0 can be cleanly merged into master.

---------------------------------------------------------------------------

by stof at 2011/12/09 03:43:38 -0800

it is not a BC break. Using ``yaml_encode`` on a string will not break the template
2011-12-09 16:12:04 +01:00
Arnout Boks
bb0d202250 Switched sanitizeParameter() for existing varToString()-method; now always stores a string representation of each parameter 2011-12-08 18:14:27 +01:00
Arnout Boks
4fe4dfd116 Fixed vendor version mismatch in tests 2011-12-08 18:09:06 +01:00
Christophe Coevoet
2c3e9adcd1 [DependencyInjection] Made the reference case insensitive
The container is case insensitive so using capital letters in a reference
made it fail in some cases when checking the dependencies.
Closes #2807
2011-12-08 16:30:50 +01:00
Fabien Potencier
237c36a167 [HttpKernel] fixed tests that can sporadically fail 2011-12-07 21:39:45 +01:00
Fabien Potencier
43a6aa9db2 merged branch Seldaek/cookiefix (PR #2698)
Commits
-------

e06cea9 [HttpFoundation] Cookie values should not be restricted

Discussion
----------

[HttpFoundation] Cookie values should not be restricted

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes

The restriction I removed makes no sense IMO because we do not use setrawcookie() to send cookies. setrawcookie() does throw a warning when the cookie value contains incorrect characters, but not setcookie(). The latter will just urlencode() the value so it becomes valid. This is also what is done by `Cookie::__toString`, so this could be used in combination with header() to just send raw cookies that are valid, even with values that are invalid in their decoded form.

PHP urldecodes cookies on input, so it all works fine.
2011-12-07 16:37:58 +01:00
Fabien Potencier
1c4bfb4c0d [Validator] added some unit tests for previous merge 2011-12-07 16:27:15 +01:00
Fabien Potencier
648fae7746 merged branch proofek/domcrawlerform-radiodisabled (PR #2768)
Commits
-------

36c7d03 Fixed GH-2720 - Fix disabled atrribute handling for radio form elements

Discussion
----------

Fixed GH-2720 - Fix disabled atrribute handling for radio form elements

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: - GH-2720

I wasn't really sure about the correct approach. This one is very minimalistic and following the existing concept of not duplicating nodes of the same name, but only storing multiple values for the same node. If you think that should be changed, let me know. Hints appreciated.

Thanks
2011-12-02 13:26:19 +01:00
Benjamin Eberlei
3c83b89c5e [DoctrineBridge] Catch user-error when the identifier is not serialized with the User entity. 2011-12-01 20:17:08 +01:00
Fabien Potencier
654352f8d1 merged branch pscheit/master (PR #2742)
Commits
-------

63e2a99 [CssSelector] Fixed Issue for XPathExprOr: missing prefix in string conversion

Discussion
----------

[CssSelector] Issue for XPathExprOr: missing prefix in string conversion

Hi there,

I created a small and dumb test for the issue. I looked at the original implementation and i think the problem is, that private properties are used in the parent class for xPathExprOr. so that the prefix cannot be accessd with $this->prefix in XPathExprOr
However I think the distribution for the prefix should be put in the parts of the or-sub-expressions the way it is shown in the test.

Hope this helps.

Best regards
Philipp
2011-12-01 08:46:19 +01:00
Fabien Potencier
416b70d5b2 merged branch conf/test-fixes-for-ci.qa.php.net-2.0 (PR #2750)
Commits
-------

c1a798e Another style fix.
eba9de1 Code style fix.
0b1abb3 1. Separated testing diacritic letters with additional check for mbstring in Symfony\Tests\Component\Console\Helper\FormatterHelperTest.php. 2. Added check if French locale was correctly set, skip the test otherwise in  Symfony\Tests\Component\Yaml\InlineTest.php. 3. Inverted check for Windows platform since testing finding php with suffixes has meaning only in Windows in Symfony\Tests\Component\Process\PhpExecutableFinderTest.php.

Discussion
----------

Test fixes for ci.qa.php.net 2.0

This is remake of https://github.com/symfony/symfony/pull/2749 against 2.0 as requested by stof. Code style fix also applied.

Original message below:
My name is Shein Alexey and I'm writing on behalf of php-qa team. As you probably know we've set up build server for testing major php versions (5.3, 5.4 and trunk for now) on the url http://ci.qa.php.net. There's also an initiative also check these versions against major php projects with good test coverage like symfony.
In our symfony builds some tests constantly fail (see http://ci.qa.php.net/view/php-userland/job/php-symfony2/420/testReport/ for example) so here are the fixes I come up with:

Separated testing diacritic letters with additional check for mbstring in Symfony\Tests\Component\Console\Helper\FormatterHelperT
Added check if French locale was correctly set, skip the test otherwise in Symfony\Tests\Component\Yaml\InlineTest.php.
Inverted check for Windows platform since testing finding php with suffixes has meaning only in Windows in Symfony\Tests\Component\Process\PhpExecutableFinderTest.php.
There is also erratic test Symfony\Tests\Component\HttpKernel\HttpCache\HttpCacheTest:testFetchesFullResponseWhenCacheStaleAndNoValidatorsPresent which randomly fails when Age header is non-zero, I'm not sure what to do here, maybe this check should be deleted since page can have age greater than zero.

Let me know what you think.
Thank you.
2011-12-01 08:33:56 +01:00
Dariusz Górecki
769c17bb95 Throw exceptions in case someone forgot to set method name in call.
Bug fix: yes
Feature add: no
Symfony2 tests pass: yes
Symfony2 tests added: yes

In general without this exception generated by php dumper container class, will cause PHP fatal error, bacause method call will look like this: `$instance->(/* arguments*/);`.
2011-11-30 15:59:17 +01:00
Shein Alexey
c1a798e2d7 Another style fix. 2011-11-30 02:46:26 +05:00
Shein Alexey
eba9de1593 Code style fix. 2011-11-30 02:22:43 +05:00
Shein Alexey
0b1abb3a57 1. Separated testing diacritic letters with additional check for mbstring in Symfony\Tests\Component\Console\Helper\FormatterHelperTest.php.
2. Added check if French locale was correctly set, skip the test otherwise in  Symfony\Tests\Component\Yaml\InlineTest.php.
3. Inverted check for Windows platform since testing finding php with suffixes has meaning only in Windows in Symfony\Tests\Component\Process\PhpExecutableFinderTest.php.
2011-11-30 02:22:13 +05:00
pscheit
63e2a993eb [CssSelector] Fixed Issue for XPathExprOr: missing prefix in string conversion 2011-11-28 22:00:26 +01:00
Arnout Boks
28730e9149 [DoctrineBridge] Added unit tests 2011-11-27 13:43:02 +01:00
Sebastian Marek
36c7d03040 Fixed GH-2720 - Fix disabled atrribute handling for radio form elements 2011-11-26 14:07:00 +00:00
Fabien Potencier
7b1dda84b9 [HttpKernel] added unit tests for previous merge 2011-11-24 08:39:49 +01:00
Fabien Potencier
5878490b16 removed unused use statements 2011-11-24 07:16:14 +01:00
Jordi Boggiano
e06cea9aaa [HttpFoundation] Cookie values should not be restricted 2011-11-23 11:38:46 +01:00
Fabien Potencier
286ce0ea40 merged branch pulzarraider/proxy_ip_fix (PR #2695)
Commits
-------

11b6156 updated unittest
a931e21 get correct client IP from X-forwarded-for header

Discussion
----------

[HttpFoundation] Get correct client IP when using trusted proxy (Varnish)

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -
Note: This is reopened PR #2686 for 2.0 branch.

If using trusted proxy (Varnish, ...) the client IP must be identified from X-Forwarded-For header. The header has de-facto standard format:

X-Forwarded-For : client1, proxy1, proxy2,

where the value is a comma+space separated list of IP addresses, the left-most being the farthest downstream client, and each successive proxy that passed the request adding the IP address where it received the request from. See: http://en.wikipedia.org/wiki/X-Forwarded-For

Function getClientIp should return only one client IP, not a list of all nonimportant IPs as it's now. Similar example can be seen in Cake framework: http://api.cakephp.org/view_source/request-handler-component/#line-477

There are many ways how to chose the first IP from X-Forwarded-For header. Any other faster and more reliable way is welcome.
2011-11-23 11:22:06 +01:00
Andrej Hudec
11b6156530 updated unittest 2011-11-22 22:28:38 +01:00
hlecorche
38f64a1bd9 [Form] added some unit tests 2011-11-22 10:31:25 +01:00
Kris Wallsmith
79ae3fced9 [Form] fixed radio and checkbox when data is not bool 2011-11-16 13:39:36 -08:00
Christophe Coevoet
58c227681e Skipped tests when PDO is not available 2011-11-14 18:39:47 +01:00
Fabien Potencier
f7c5bf1db2 [HttpKernel] fixed Content-Length header when using ESI tags (closes #2623) 2011-11-14 13:46:20 +01:00