Merge branch '4.4' into 5.2

* 4.4:
  Update .github/workflows/tests.yml
  Don't call class_exists() on null
  Added and improved Bulgarian translations
  PHP 8.1 must not cause the build to fail (yet)
  Add _run_tests bash function
  Add a GitHub Action for tests against PHP 8.1
  [HttpClient] fix adding query string to relative URLs with scoped clients
  [Security] Added Ukrainian translations
This commit is contained in:
Alexander M. Turek 2021-05-15 14:42:34 +02:00
commit ec761d6b94
7 changed files with 91 additions and 14 deletions

View File

@ -191,3 +191,58 @@ jobs:
docker run --rm -e COMPOSER_ROOT_VERSION -v $(pwd):/app -v $(which composer):/usr/local/bin/composer -v /usr/local/bin/vulcain:/usr/local/bin/vulcain -w /app php:7.4-alpine ./phpunit src/Symfony/Component/HttpClient/Tests/CurlHttpClientTest.php --filter testHttp2Push
sudo rm -rf .phpunit
[ -d .phpunit.bak ] && mv .phpunit.bak .phpunit
nightly:
name: PHPUnit on PHP nightly
runs-on: Ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
coverage: "none"
ini-values: "memory_limit=-1"
php-version: "8.1"
- name: Configure composer
run: |
COMPOSER_HOME="$(composer config home)"
composer self-update
([ -d "$COMPOSER_HOME" ] || mkdir "$COMPOSER_HOME") && cp .github/composer-config.json "$COMPOSER_HOME/config.json"
echo "COMPOSER_ROOT_VERSION=$(grep -m1 SYMFONY_VERSION .travis.yml | grep -o '[0-9.x]*').x-dev" >> $GITHUB_ENV
- name: Install dependencies
run: |
echo "::group::fake PHP version"
composer config platform.php 8.0.99
echo "::group::composer update"
composer update --no-progress --ansi
echo "::endgroup::"
echo "::group::install phpunit"
./phpunit install
echo "::endgroup::"
- name: Run tests
run: |
_run_tests() {
ok=0
echo "::group::$1"
# Run the tests
./phpunit --colors=always --exclude-group tty,benchmark,intl-data ./$1 2>&1 || ok=1
echo ::endgroup::
if [ $ok -ne 0 ]; then
echo "::error::$1 failed"
fi
# Make the tests always pass because we don't want the build to fail (yet).
return 0
#return $ok
}
export -f _run_tests
find src/Symfony -mindepth 2 -type f -name phpunit.xml.dist -not -wholename '*/Bridge/PhpUnit/*' -print0 | xargs -0 -n1 dirname | sort | parallel _run_tests

View File

@ -43,7 +43,7 @@ class LazyLoadingValueHolderGenerator extends BaseGenerator
public function getProxifiedClass(Definition $definition): ?string
{
if (!$definition->hasTag('proxy')) {
return class_exists($class = $definition->getClass()) || interface_exists($class, false) ? $class : null;
return ($class = $definition->getClass()) && (class_exists($class) || interface_exists($class, false)) ? $class : null;
}
if (!$definition->isLazy()) {
throw new \InvalidArgumentException(sprintf('Invalid definition for service of class "%s": setting the "proxy" tag on a service requires it to be "lazy".', $definition->getClass()));

View File

@ -88,8 +88,13 @@ final class CheckTypeDeclarationsPass extends AbstractRecursivePass
return parent::processValue($value, $isRoot);
}
if (!$this->autoload && !class_exists($class = $value->getClass(), false) && !interface_exists($class, false)) {
return parent::processValue($value, $isRoot);
if (!$this->autoload) {
if (!$class = $value->getClass()) {
return parent::processValue($value, $isRoot);
}
if (!class_exists($class, false) && !interface_exists($class, false)) {
return parent::processValue($value, $isRoot);
}
}
if (ServiceLocator::class === $value->getClass()) {

View File

@ -73,11 +73,12 @@ class ScopingHttpClient implements HttpClientInterface, ResetInterface, LoggerAw
throw $e;
}
$options = self::mergeDefaultOptions($options, $this->defaultOptionsByRegexp[$this->defaultRegexp], true);
$defaultOptions = $this->defaultOptionsByRegexp[$this->defaultRegexp];
$options = self::mergeDefaultOptions($options, $defaultOptions, true);
if (\is_string($options['base_uri'] ?? null)) {
$options['base_uri'] = self::parseUrl($options['base_uri']);
}
$url = implode('', self::resolveUrl($url, $options['base_uri'] ?? null));
$url = implode('', self::resolveUrl($url, $options['base_uri'] ?? null, $defaultOptions['query'] ?? []));
}
foreach ($this->defaultOptionsByRegexp as $regexp => $defaultOptions) {

View File

@ -30,9 +30,9 @@ class ScopingHttpClientTest extends TestCase
public function testRelativeUrlWithDefaultRegexp()
{
$mockClient = new MockHttpClient();
$client = new ScopingHttpClient($mockClient, ['.*' => ['base_uri' => 'http://example.com']], '.*');
$client = new ScopingHttpClient($mockClient, ['.*' => ['base_uri' => 'http://example.com', 'query' => ['a' => 'b']]], '.*');
$this->assertSame('http://example.com/foo', $client->request('GET', '/foo')->getInfo('url'));
$this->assertSame('http://example.com/foo?f=g&a=b', $client->request('GET', '/foo?f=g')->getInfo('url'));
}
/**

View File

@ -20,7 +20,7 @@
</trans-unit>
<trans-unit id="5">
<source>Cookie has already been used by someone else.</source>
<target>Това cookie вече се ползва от някой друг.</target>
<target>Тази бисквитка вече се ползва от някой друг.</target>
</trans-unit>
<trans-unit id="6">
<source>Not privileged to request the resource.</source>
@ -36,11 +36,11 @@
</trans-unit>
<trans-unit id="10">
<source>No session available, it either timed out or cookies are not enabled.</source>
<target>Сесията не е достъпна, или времето за достъп е изтекло, или кукитата не са разрешени.</target>
<target>Сесията не е достъпна, или времето за достъп е изтекло, или бисквитките не са разрешени.</target>
</trans-unit>
<trans-unit id="11">
<source>No token could be found.</source>
<target>Токена не е открит.</target>
<target>Токенът не е открит.</target>
</trans-unit>
<trans-unit id="12">
<source>Username could not be found.</source>
@ -48,7 +48,7 @@
</trans-unit>
<trans-unit id="13">
<source>Account has expired.</source>
<target>Акаунта е изтекъл.</target>
<target>Акаунтът е изтекъл.</target>
</trans-unit>
<trans-unit id="14">
<source>Credentials have expired.</source>
@ -56,20 +56,28 @@
</trans-unit>
<trans-unit id="15">
<source>Account is disabled.</source>
<target>Акаунта е деактивиран.</target>
<target>Акаунтът е деактивиран.</target>
</trans-unit>
<trans-unit id="16">
<source>Account is locked.</source>
<target>Акаунта е заключен.</target>
<target>Акаунтът е заключен.</target>
</trans-unit>
<trans-unit id="17">
<source>Too many failed login attempts, please try again later.</source>
<target>Твърде много грешни опити за вход, моля опитайте по-късно.</target>
<target>Твърде много неуспешни опити за вход, моля опитайте по-късно.</target>
</trans-unit>
<trans-unit id="18">
<source>Invalid or expired login link.</source>
<target>Невалиден или изтекъл линк за вход.</target>
</trans-unit>
<trans-unit id="19">
<source>Too many failed login attempts, please try again in %minutes% minute.</source>
<target>Прекалено много неуспешни опити за вход, моля опитайте отново след %minutes% минута.</target>
</trans-unit>
<trans-unit id="20">
<source>Too many failed login attempts, please try again in %minutes% minutes.</source>
<target>Прекалено много неуспешни опити за вход, моля опитайте отново след %minutes% минути.</target>
</trans-unit>
</body>
</file>
</xliff>

View File

@ -70,6 +70,14 @@
<source>Invalid or expired login link.</source>
<target>Посилання для входу недійсне, або термін його дії закінчився.</target>
</trans-unit>
<trans-unit id="19">
<source>Too many failed login attempts, please try again in %minutes% minute.</source>
<target>Забагато невдалих спроб входу. Будь ласка, спробуйте знову через %minutes% хвилину.</target>
</trans-unit>
<trans-unit id="20">
<source>Too many failed login attempts, please try again in %minutes% minutes.</source>
<target>Забагато невдалих спроб входу. Будь ласка, спробуйте знову через %minutes% хв.</target>
</trans-unit>
</body>
</file>
</xliff>