Commit Graph

49743 Commits

Author SHA1 Message Date
Grégoire Pineau
e1de806050 [Workflow] Normalize workflow changelog 2020-07-01 15:44:40 +02:00
Fabien Potencier
5b6139f488 feature #37428 [Workflow] Added Function (and Twig extension) to retrieve a specific transition (Carlos Pereira De Amorim)
This PR was squashed before being merged into the 5.2-dev branch.

Discussion
----------

[Workflow] Added Function (and Twig extension) to retrieve a specific transition

You can now easily retrieve a specific transition. Useful when you want the metadata of a specific transition.

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | hmmmm, should I create a ticket first ?
| License       | MIT
| Doc PR        | https://github.com/symfony/symfony-docs/pull/13907

I needed to get the metadata of a transition, but in order to do that, you need the transition object. So here is a PR to easily get the transition object

Commits
-------

0eebe74259 [Workflow] Added Function (and Twig extension) to retrieve a specific transition
2020-07-01 14:24:19 +02:00
Carlos Pereira De Amorim
0eebe74259 [Workflow] Added Function (and Twig extension) to retrieve a specific transition 2020-07-01 14:24:18 +02:00
Fabien Potencier
d8082fa2f8 feature #36487 [HttpClient] Add MockResponse::getRequestMethod() and getRequestUrl() to allow inspecting which request has been sent (javespi)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[HttpClient] Add MockResponse::getRequestMethod() and getRequestUrl() to allow inspecting which request has been sent

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | yes <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | -  <!-- prefix each issue number with "Fix #", if any -->
| License       | MIT
| Doc PR        | - <!-- required for new features -->
<!--
Replace this notice by a short README for your feature/bugfix. This will help people
understand your PR and can be used as a start for the documentation.

Additionally (see https://symfony.com/releases):
 - Always add tests and ensure they pass.
 - Never break backward compatibility (see https://symfony.com/bc).
 - Bug fixes must be submitted against the lowest maintained branch where they apply
   (lowest branches are regularly merged to upper ones so they get the fixes too.)
 - Features and deprecations must be submitted against branch master.
-->

---

As same as the `MockResponse` class has `getRequestOptions()` when doing a request; I've added:
* `getRequestUrl()` - returns the URL used when doing the request
* `getRequestMethod()` - returns the HTTP method used when doing the request

With these two getters, we would be able to assert that the method and URL passed to the `HttpClient` were well generated. I've tried to assert the URL generated in a unit test of a class with a `SymfonyHttpClient` injected and it wasn't possible. Calling `$mock->getInfo('url')` returns `null`.

Example, if we have a class with `HttpClientInterface` injected like this:

```php
final class SymfonyHttpUserClient
{
    private HttpClientInterface $httpClient;
    private string $baseUri;

    public function __construct(
        HttpClientInterface $httpClient,
        string $baseUri
    ) {
        $this->httpClient = $httpClient;
        $this->baseUri = $baseUri;
    }

    public function getById(string $userId): void
    {
        $this->httpClient->request(
            'GET',
            $this->baseUri . $customerId
        );
    }
}
```

And if we want to do a unit test of `SymfonyHttpUserClient` right now we are not able to check if the URL of the request was well-formed passing a `MockResponse`. Also, we weren't able to assert the HTTP method (maybe this piece is not so critical to assert in the unit test).

```php
class SymfonyHttpUserClientTests extends TestCase
{
    public function testGetById(): void
    {
        $baseUri = 'https://user-api.test/api/v1/users/';
        $mockResponse = new MockResponse();
        $symfonyHttpUserClient = new SymfonyHttpUserClient(
            new MockHttpClient(
                [$mockResponse],
                $baseUri
            ),
            $baseUri
        );

        // test get by id:
        $symfonyHttpUserClient->getById('some-user-id');

        // cannot be asserted right now:
        $this->assertSame($mockResponse->getInfo('url'), $baseUri . 'some-user-id'); // fail
        $this->assertSame($mockResponse->getInfo('http_method'), 'GET'); // fail

        // it could be with the new getters:
        $this->assertSame($mockResponse->getRequestUrl(), $baseUri . 'some-user-id');
        $this->assertSame($mockResponse->getRequestMethod(), 'GET');
    }
}
```

This only happens if the class has injected the HttpClient and if it is used inside void methods with no being able to return the response. If the class returns the response, `url` and `http_method` are available with `$response->getInfo()` call. But this response object is a new one, is not the mock passed by argument when you instance the MockHttpClient.

Var dumps of `getInfo` array:

```
$response->getInfo() from MockClient:

..array(10) {
  ["start_time"]=>
  float(1587109014.7985)
  ["user_data"]=>
  NULL
  ["http_code"]=>
  int(200)
  ["response_headers"]=>
  array(0) {
  }
  ["error"]=>
  NULL
  ["canceled"]=>
  bool(false)
  ["redirect_count"]=>
  int(0)
  ["redirect_url"]=>
  NULL
  ["http_method"]=>
  string(3) "GET"
  ["url"]=>
  string(47) "https://user-api.test/api/v1/users/some-user-id"
}

$mock->getInfo()

array(4) {
  ["http_code"]=>
  int(200)
  ["response_headers"]=>
  array(0) {
  }
  ["error"]=>
  NULL
  ["canceled"]=>
  bool(false)
}
```

This is a minor change, I opened the PR with `4.4` as base branch; but not sure if it should be opened with `5.0` as base branch or even `master` taking account is a feature (add two new getters in MockResponse class). Let me know if I didn't follow right the instructions (first PR on Symfony project 😃)

Thanks!

Commits
-------

7a250d80c1 [HttpClient] Add MockResponse::getRequestMethod() and getRequestUrl() to allow inspecting which request has been sent
2020-07-01 14:18:06 +02:00
Fabien Potencier
501542a0dd feature #37295 Move event alias mappings to their components (derrabus)
This PR was merged into the 5.2-dev branch.

Discussion
----------

Move event alias mappings to their components

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | N/A
| License       | MIT
| Doc PR        | N/A

For a small console tool, I wanted to use the Console, EventDispatcher and DI components standalone. In order to make use of aliased events, I had to copy over the mapping information from FrameworkBundle, which was a bit unfortunate.

With this PR, I'd like to suggest to store all alias mappings on the `*Events` classes of each component instead. This change will make the mapping reusable outside of the full-stack framework.

Note: I've bumped the dependencies of FrameworkBundle/SercurityBundle in order to gain access to the moved mapping information. If any of the bumps is too heavy, please tell me and I'll implement a fallback instead.

Commits
-------

28e6f6f72c Move event alias mappings to their components.
2020-07-01 14:12:45 +02:00
Nicolas Grekas
c2e2560657 fix merge 2020-06-30 20:21:22 +02:00
Nicolas Grekas
1a3979a412 Merge branch '5.1'
* 5.1:
  [Bridge/Twig] Relax tests
2020-06-30 19:59:55 +02:00
Nicolas Grekas
d51e8d534e Merge branch '5.0' into 5.1
* 5.0:
  [Bridge/Twig] Relax tests
2020-06-30 19:59:51 +02:00
Nicolas Grekas
5c056c18fc Merge branch '4.4' into 5.0
* 4.4:
  [Bridge/Twig] Relax tests
2020-06-30 19:59:45 +02:00
Nicolas Grekas
b9354dc62f Merge branch '3.4' into 4.4
* 3.4:
  [Bridge/Twig] Relax tests
2020-06-30 19:59:39 +02:00
Nicolas Grekas
91f30e0b62 [Bridge/Twig] Relax tests 2020-06-30 19:58:38 +02:00
Nicolas Grekas
1bbfde581f Merge branch '5.1'
* 5.1:
  [ErrorHandler] fix throwing from __toString()
  Removed comments and requirements relative to php <5.5 (not supported anymore)
  Fix caching of parent locales file in translator
  fix validating lazy properties that evaluate to null
2020-06-30 19:42:41 +02:00
Nicolas Grekas
85d471bf05 Merge branch '5.0' into 5.1
* 5.0:
  [ErrorHandler] fix throwing from __toString()
  Removed comments and requirements relative to php <5.5 (not supported anymore)
  Fix caching of parent locales file in translator
  fix validating lazy properties that evaluate to null
2020-06-30 19:42:22 +02:00
Nicolas Grekas
23fcbd4dd5 Merge branch '4.4' into 5.0
* 4.4:
  [ErrorHandler] fix throwing from __toString()
  Removed comments and requirements relative to php <5.5 (not supported anymore)
  Fix caching of parent locales file in translator
  fix validating lazy properties that evaluate to null
2020-06-30 19:40:59 +02:00
Nicolas Grekas
450034c986 Merge branch '3.4' into 4.4
* 3.4:
  [ErrorHandler] fix throwing from __toString()
  Removed comments and requirements relative to php <5.5 (not supported anymore)
  fix validating lazy properties that evaluate to null
2020-06-30 19:40:09 +02:00
Nicolas Grekas
52ddce1a74 bug #37447 [Validator] fix validating lazy properties that evaluate to null (xabbuh)
This PR was merged into the 3.4 branch.

Discussion
----------

[Validator] fix validating lazy properties that evaluate to null

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #37430
| License       | MIT
| Doc PR        |

Commits
-------

776daf28b4 fix validating lazy properties that evaluate to null
2020-06-30 19:35:43 +02:00
Nicolas Grekas
034be4415c bug #37464 [ErrorHandler] fix throwing from __toString() (nicolas-grekas)
This PR was merged into the 3.4 branch.

Discussion
----------

[ErrorHandler] fix throwing from __toString()

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #37142
| License       | MIT
| Doc PR        | -

Commits
-------

aeb4637341 [ErrorHandler] fix throwing from __toString()
2020-06-30 19:29:43 +02:00
Nicolas Grekas
aeb4637341 [ErrorHandler] fix throwing from __toString() 2020-06-30 19:28:29 +02:00
Javier Espinosa
7a250d80c1 [HttpClient] Add MockResponse::getRequestMethod() and getRequestUrl() to allow inspecting which request has been sent 2020-06-30 18:39:01 +02:00
Nicolas Grekas
187b66bb40 minor #35959 [VarDumper] improve rendering HTML (ln-dim)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[VarDumper] improve rendering HTML

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #35800
| License       | MIT
| Doc PR        | -

I improved the rendering so that HtmlDumper makes a decision on which element should be rendered compacted/expanded in PHP, not JavaScript.

Commits
-------

0a4ef897b7 [VarDumper] improve rendering HTML
2020-06-30 16:44:03 +02:00
Dmitrii Lozhkin
0a4ef897b7 [VarDumper] improve rendering HTML 2020-06-30 16:43:42 +02:00
Alexander M. Turek
28e6f6f72c Move event alias mappings to their components. 2020-06-30 16:13:44 +02:00
Nicolas Grekas
78e6fc4b42 bug #37449 [Translation] Fix caching of parent locales file in translator (jvasseur)
This PR was merged into the 4.4 branch.

Discussion
----------

[Translation] Fix caching of parent locales file in translator

| Q             | A
| ------------- | ---
| Branch?       | 4.4 (this is the lowest maintained branch with this code)
| Bug fix?      | yes
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       |
| License       | MIT
| Doc PR        |

The `parentLocales` property was probably meant as a cache for the content of the `parents.json` file but instead the content is stored in a local variable and the property stays `null`. This means the file is read on each call to `computeFallbackLocales`.

This PR update the code to what was probably meant to be.

(Ref https://github.com/symfony/symfony/pull/28070)

Commits
-------

02c9ac68a4 Fix caching of parent locales file in translator
2020-06-30 15:55:33 +02:00
Nicolas Grekas
801f4cd7ac minor #37458 Removed comments and requirements relative to php <5.5 (not supported anymore) (lyrixx)
This PR was merged into the 3.4 branch.

Discussion
----------

Removed comments and requirements relative to php <5.5 (not supported anymore)

| Q             | A
| ------------- | ---
| Branch?       | 3.43.43.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       |
| License       | MIT
| Doc PR        |

---

There is also https://github.com/symfony/symfony/blob/3.4/src/Symfony/Component/EventDispatcher/Tests/AbstractEventDispatcherTest.php#L270-L276 but I think we could let it in place (and this file does not exist on master)

Commits
-------

5c5ea7500e Removed comments and requirements relative to php <5.5 (not supported anymore)
2020-06-30 14:59:42 +02:00
Grégoire Pineau
5c5ea7500e Removed comments and requirements relative to php <5.5 (not supported anymore) 2020-06-30 14:50:28 +02:00
Nicolas Grekas
d555112fbf feature #37443 [HttpClient] add StreamableInterface to ease turning responses into PHP streams (nicolas-grekas)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[HttpClient] add StreamableInterface to ease turning responses into PHP streams

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | -
| Tickets       | -
| License       | MIT
| Doc PR        | -

Commits
-------

de103b31a9 [HttpClient] add StreamableInterface to ease turning responses into PHP streams
2020-06-30 14:30:51 +02:00
Nicolas Grekas
f42893c022 CS fix 2020-06-30 13:54:22 +02:00
Nicolas Grekas
3ce43915bd minor #37433 Console ProgressBar: Change redraw default value to 25fps (flack)
This PR was squashed before being merged into the 5.2-dev branch.

Discussion
----------

Console ProgressBar: Change redraw default value to 25fps

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       |
| License       | MIT
| Doc PR        |

`ProgressBar` has a default value of `0.1` for `$minSecondsBetweenRedraws` which works out to 10 fps, so below the threshhold at which the human eye perceives it as a moving image instead of a series of individual images. Of course, the console's progress bar is not really an animation tool, but it seems like a low-hanging fruit to change the redraw frequency to something that can be perceived as a fluid motion. So I'm proposing to change `$minSecondsBetweenRedraws` to `0.016666666666667`, i.e. 60 fps, which is a fairly typical refresh rate for computer screens, so redrawing more often than that would be pointless. It means of course to redraw six times more often than currently, but i guess performance is not such a big concern here, right?

Commits
-------

b1c38bada7 Console ProgressBar: Change redraw default value to 25fps
2020-06-30 11:12:36 +02:00
flack
b1c38bada7 Console ProgressBar: Change redraw default value to 25fps 2020-06-30 11:11:53 +02:00
Christian Flothmann
6aecad7438 Merge branch '5.1'
* 5.1:
  fix compatibility with Doctrine DBAL 3.0
  skip test if guesser is not supported
  Added missing license headers
2020-06-29 16:32:23 +02:00
Christian Flothmann
eb58ea6a26 Merge branch '5.0' into 5.1
* 5.0:
  fix compatibility with Doctrine DBAL 3.0
  skip test if guesser is not supported
2020-06-29 16:31:29 +02:00
Christian Flothmann
5a91e51154 Merge branch '4.4' into 5.0
* 4.4:
  fix compatibility with Doctrine DBAL 3.0
  skip test if guesser is not supported
2020-06-29 16:24:36 +02:00
Christian Flothmann
f194602c30 minor #37450 [Mime] skip test if guesser is not supported (xabbuh)
This PR was merged into the 4.4 branch.

Discussion
----------

[Mime] skip test if guesser is not supported

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       |
| License       | MIT
| Doc PR        |

fixes tests on AppVeyor

Commits
-------

3b77abea65 skip test if guesser is not supported
2020-06-29 16:24:11 +02:00
Christian Flothmann
4e16dfdb09 minor #37448 [Messenger] fix compatibility with Doctrine DBAL 3.0 (xabbuh)
This PR was merged into the 4.4 branch.

Discussion
----------

[Messenger] fix compatibility with Doctrine DBAL 3.0

| Q             | A
| ------------- | ---
| Branch?       | 5.0
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       |
| License       | MIT
| Doc PR        |

see doctrine/dbal#4100 and doctrine/dbal#4125

Commits
-------

b17df8cdd7 fix compatibility with Doctrine DBAL 3.0
2020-06-29 16:22:04 +02:00
Christian Flothmann
b17df8cdd7 fix compatibility with Doctrine DBAL 3.0 2020-06-29 15:55:34 +02:00
Christian Flothmann
3b77abea65 skip test if guesser is not supported 2020-06-29 15:46:05 +02:00
Jérôme
02c9ac68a4
Fix caching of parent locales file in translator 2020-06-29 15:31:43 +02:00
Christian Flothmann
776daf28b4 fix validating lazy properties that evaluate to null 2020-06-29 12:55:42 +02:00
Fabien Potencier
f706d6a276 minor #37445 [Security] Added missing license headers (wouterj)
This PR was merged into the 5.1 branch.

Discussion
----------

[Security] Added missing license headers

| Q             | A
| ------------- | ---
| Branch?       | 5.1
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

See 3be6ce121b

Seems like the fabbot reviews (and I) missed quite a lot of these in my big security PR.

Commits
-------

ea81b61e5f Added missing license headers
2020-06-29 10:19:14 +02:00
Wouter de Jong
ea81b61e5f Added missing license headers 2020-06-28 20:41:01 +02:00
Nicolas Grekas
de103b31a9 [HttpClient] add StreamableInterface to ease turning responses into PHP streams 2020-06-28 17:56:16 +02:00
Nicolas Grekas
75031a1230 Merge branch '5.1'
* 5.1:
  Fix test that fails on old distros
  Fix: compatibility with phpunit 9.3
  [DoctrineBridge] work around Connection::ping() deprecation
  [MimeType] Duplicated MimeType due to PHP Bug
  [HttpClient] fix casting TraceableResponse to php streams
  [DI] fix parsing of argument type=binary in xml
  fix guessing form types for DateTime types
  fix handling typed properties as constraint options
  Fix the 'supports' method argument type of the security voter
  Use the driverConnection executeUpdate method
2020-06-28 17:36:15 +02:00
Nicolas Grekas
009961795b bug #37440 [HttpClient] fix casting TraceableResponse to php streams (nicolas-grekas)
This PR was merged into the 5.1 branch.

Discussion
----------

[HttpClient] fix casting TraceableResponse to php streams

| Q             | A
| ------------- | ---
| Branch?       | 5.1
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #37393
| License       | MIT
| Doc PR        | -

We'd better replace these checks by an `instanceof` one, but that'd be for master.

Commits
-------

5733289278 [HttpClient] fix casting TraceableResponse to php streams
2020-06-28 17:33:45 +02:00
Nicolas Grekas
4ad5079082 Merge branch '5.0' into 5.1
* 5.0:
  Fix test that fails on old distros
  Fix: compatibility with phpunit 9.3
  [DoctrineBridge] work around Connection::ping() deprecation
  [MimeType] Duplicated MimeType due to PHP Bug
  [DI] fix parsing of argument type=binary in xml
  fix guessing form types for DateTime types
  fix handling typed properties as constraint options
  Fix the 'supports' method argument type of the security voter
  Use the driverConnection executeUpdate method
2020-06-28 17:32:35 +02:00
Nicolas Grekas
55768b18c9 Merge branch '4.4' into 5.0
* 4.4:
  Fix test that fails on old distros
  Fix: compatibility with phpunit 9.3
  [DoctrineBridge] work around Connection::ping() deprecation
  [MimeType] Duplicated MimeType due to PHP Bug
  [DI] fix parsing of argument type=binary in xml
  fix guessing form types for DateTime types
  fix handling typed properties as constraint options
  Use the driverConnection executeUpdate method
2020-06-28 17:28:17 +02:00
Nicolas Grekas
27290714b7 Merge branch '3.4' into 4.4
* 3.4:
  Fix test that fails on old distros
2020-06-28 17:22:55 +02:00
Nicolas Grekas
b344f6d7db Fix test that fails on old distros 2020-06-28 17:22:27 +02:00
Nicolas Grekas
9709500d29 bug #37418 [PhpUnitBridge] Fix compatibility with phpunit 9.3 (Gennadi Janzen)
This PR was merged into the 4.4 branch.

Discussion
----------

[PhpUnitBridge] Fix compatibility with phpunit 9.3

| Q             | A
| ------------- | ---
| Branch?       | master for features / 4.4 <!-- see below -->
| Bug fix?      | yes
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | - <!-- prefix each issue number with "Fix #", if any -->
| License       | MIT
| Doc PR        | -<!-- required for new features -->

In PHPUnit 9.3 some Classes were moved or renamed, to make the PhpunitBridge compatible with PhpUnit 9.3 it necessary to call the new Loader instead of the Registry.
<!--
Replace this notice by a short README for your feature/bugfix. This will help people
understand your PR and can be used as a start for the documentation.

Additionally (see https://symfony.com/releases):
 - Always add tests and ensure they pass.
 - Never break backward compatibility (see https://symfony.com/bc).
 - Bug fixes must be submitted against the lowest maintained branch where they apply
   (lowest branches are regularly merged to upper ones so they get the fixes too.)
 - Features and deprecations must be submitted against branch master.
-->

Commits
-------

de71a12f3b Fix: compatibility with phpunit 9.3
2020-06-28 17:12:52 +02:00
Gennadi Janzen
de71a12f3b Fix: compatibility with phpunit 9.3 2020-06-28 17:12:40 +02:00
Nicolas Grekas
9c6d53a78b bug #37441 [DoctrineBridge] work around Connection::ping() deprecation (nicolas-grekas)
This PR was merged into the 4.4 branch.

Discussion
----------

[DoctrineBridge] work around Connection::ping() deprecation

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

Follows e603a2e233

Commits
-------

9ccf043c7c [DoctrineBridge] work around Connection::ping() deprecation
2020-06-28 17:08:21 +02:00