Merge branch '3.4' into 4.4
* 3.4: [Cache] fix catching auth errors Fix CS [FrameworkBundle] set default session.handler alias if handler_id is not provided Fix CS Readability update Fix checks for phpunit releases on Composer 2 (resolves #37601) [SCA] Minor fixes on tests
This commit is contained in:
commit
50505cb9d2
@ -196,7 +196,11 @@ if (!file_exists("$PHPUNIT_DIR/$PHPUNIT_VERSION_DIR/phpunit") || $configurationH
|
|||||||
'requires' => ['php' => '*'],
|
'requires' => ['php' => '*'],
|
||||||
];
|
];
|
||||||
|
|
||||||
if (1 === count($info['versions'])) {
|
$stableVersions = array_filter($info['versions'], function($v) {
|
||||||
|
return !preg_match('/-dev$|^dev-/', $v);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!$stableVersions) {
|
||||||
$passthruOrFail("$COMPOSER create-project --ignore-platform-reqs --no-install --prefer-dist --no-scripts --no-plugins --no-progress -s dev phpunit/phpunit $PHPUNIT_VERSION_DIR \"$PHPUNIT_VERSION.*\"");
|
$passthruOrFail("$COMPOSER create-project --ignore-platform-reqs --no-install --prefer-dist --no-scripts --no-plugins --no-progress -s dev phpunit/phpunit $PHPUNIT_VERSION_DIR \"$PHPUNIT_VERSION.*\"");
|
||||||
} else {
|
} else {
|
||||||
$passthruOrFail("$COMPOSER create-project --ignore-platform-reqs --no-install --prefer-dist --no-scripts --no-plugins --no-progress phpunit/phpunit $PHPUNIT_VERSION_DIR \"$PHPUNIT_VERSION.*\"");
|
$passthruOrFail("$COMPOSER create-project --ignore-platform-reqs --no-install --prefer-dist --no-scripts --no-plugins --no-progress phpunit/phpunit $PHPUNIT_VERSION_DIR \"$PHPUNIT_VERSION.*\"");
|
||||||
|
@ -942,6 +942,7 @@ class FrameworkExtension extends Extension
|
|||||||
// Set the handler class to be null
|
// Set the handler class to be null
|
||||||
$container->getDefinition('session.storage.native')->replaceArgument(1, null);
|
$container->getDefinition('session.storage.native')->replaceArgument(1, null);
|
||||||
$container->getDefinition('session.storage.php_bridge')->replaceArgument(0, null);
|
$container->getDefinition('session.storage.php_bridge')->replaceArgument(0, null);
|
||||||
|
$container->setAlias('session.handler', 'session.handler.native_file')->setPrivate(true);
|
||||||
} else {
|
} else {
|
||||||
$container->resolveEnvPlaceholders($config['handler_id'], null, $usedEnvs);
|
$container->resolveEnvPlaceholders($config['handler_id'], null, $usedEnvs);
|
||||||
|
|
||||||
|
@ -556,6 +556,7 @@ abstract class FrameworkExtensionTest extends TestCase
|
|||||||
$this->assertTrue($container->hasDefinition('session'), '->registerSessionConfiguration() loads session.xml');
|
$this->assertTrue($container->hasDefinition('session'), '->registerSessionConfiguration() loads session.xml');
|
||||||
$this->assertNull($container->getDefinition('session.storage.native')->getArgument(1));
|
$this->assertNull($container->getDefinition('session.storage.native')->getArgument(1));
|
||||||
$this->assertNull($container->getDefinition('session.storage.php_bridge')->getArgument(0));
|
$this->assertNull($container->getDefinition('session.storage.php_bridge')->getArgument(0));
|
||||||
|
$this->assertSame('session.handler.native_file', (string) $container->getAlias('session.handler'));
|
||||||
|
|
||||||
$expected = ['session', 'initialized_session'];
|
$expected = ['session', 'initialized_session'];
|
||||||
$this->assertEquals($expected, array_keys($container->getDefinition('session_listener')->getArgument(0)->getValues()));
|
$this->assertEquals($expected, array_keys($container->getDefinition('session_listener')->getArgument(0)->getValues()));
|
||||||
|
@ -50,7 +50,7 @@ class UserPasswordEncoderCommandTest extends AbstractWebTestCase
|
|||||||
], ['interactive' => false]);
|
], ['interactive' => false]);
|
||||||
|
|
||||||
$this->assertStringContainsString('[ERROR] The password must not be empty.', $this->passwordEncoderCommandTester->getDisplay());
|
$this->assertStringContainsString('[ERROR] The password must not be empty.', $this->passwordEncoderCommandTester->getDisplay());
|
||||||
$this->assertEquals($statusCode, 1);
|
$this->assertEquals(1, $statusCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testEncodePasswordBcrypt()
|
public function testEncodePasswordBcrypt()
|
||||||
|
@ -123,8 +123,15 @@ class ContentSecurityPolicyHandler
|
|||||||
|
|
||||||
$headers = $this->getCspHeaders($response);
|
$headers = $this->getCspHeaders($response);
|
||||||
|
|
||||||
|
$types = [
|
||||||
|
'script-src' => 'csp_script_nonce',
|
||||||
|
'script-src-elem' => 'csp_script_nonce',
|
||||||
|
'style-src' => 'csp_style_nonce',
|
||||||
|
'style-src-elem' => 'csp_style_nonce',
|
||||||
|
];
|
||||||
|
|
||||||
foreach ($headers as $header => $directives) {
|
foreach ($headers as $header => $directives) {
|
||||||
foreach (['script-src' => 'csp_script_nonce', 'script-src-elem' => 'csp_script_nonce', 'style-src' => 'csp_style_nonce', 'style-src-elem' => 'csp_style_nonce'] as $type => $tokenName) {
|
foreach ($types as $type => $tokenName) {
|
||||||
if ($this->authorizesInline($directives, $type)) {
|
if ($this->authorizesInline($directives, $type)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -173,30 +173,30 @@ trait RedisTrait
|
|||||||
$initializer = function ($redis) use ($connect, $params, $dsn, $auth, $hosts) {
|
$initializer = function ($redis) use ($connect, $params, $dsn, $auth, $hosts) {
|
||||||
try {
|
try {
|
||||||
@$redis->{$connect}($hosts[0]['host'] ?? $hosts[0]['path'], $hosts[0]['port'] ?? null, $params['timeout'], (string) $params['persistent_id'], $params['retry_interval']);
|
@$redis->{$connect}($hosts[0]['host'] ?? $hosts[0]['path'], $hosts[0]['port'] ?? null, $params['timeout'], (string) $params['persistent_id'], $params['retry_interval']);
|
||||||
|
|
||||||
|
set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; });
|
||||||
|
$isConnected = $redis->isConnected();
|
||||||
|
restore_error_handler();
|
||||||
|
if (!$isConnected) {
|
||||||
|
$error = preg_match('/^Redis::p?connect\(\): (.*)/', $error, $error) ? sprintf(' (%s)', $error[1]) : '';
|
||||||
|
throw new InvalidArgumentException(sprintf('Redis connection "%s" failed: ', $dsn).$error.'.');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((null !== $auth && !$redis->auth($auth))
|
||||||
|
|| ($params['dbindex'] && !$redis->select($params['dbindex']))
|
||||||
|
|| ($params['read_timeout'] && !$redis->setOption(\Redis::OPT_READ_TIMEOUT, $params['read_timeout']))
|
||||||
|
) {
|
||||||
|
$e = preg_replace('/^ERR /', '', $redis->getLastError());
|
||||||
|
throw new InvalidArgumentException(sprintf('Redis connection "%s" failed: ', $dsn).$e.'.');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (0 < $params['tcp_keepalive'] && \defined('Redis::OPT_TCP_KEEPALIVE')) {
|
||||||
|
$redis->setOption(\Redis::OPT_TCP_KEEPALIVE, $params['tcp_keepalive']);
|
||||||
|
}
|
||||||
} catch (\RedisException $e) {
|
} catch (\RedisException $e) {
|
||||||
throw new InvalidArgumentException(sprintf('Redis connection "%s" failed: ', $dsn).$e->getMessage());
|
throw new InvalidArgumentException(sprintf('Redis connection "%s" failed: ', $dsn).$e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; });
|
|
||||||
$isConnected = $redis->isConnected();
|
|
||||||
restore_error_handler();
|
|
||||||
if (!$isConnected) {
|
|
||||||
$error = preg_match('/^Redis::p?connect\(\): (.*)/', $error, $error) ? sprintf(' (%s)', $error[1]) : '';
|
|
||||||
throw new InvalidArgumentException(sprintf('Redis connection "%s" failed: ', $dsn).$error.'.');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((null !== $auth && !$redis->auth($auth))
|
|
||||||
|| ($params['dbindex'] && !$redis->select($params['dbindex']))
|
|
||||||
|| ($params['read_timeout'] && !$redis->setOption(\Redis::OPT_READ_TIMEOUT, $params['read_timeout']))
|
|
||||||
) {
|
|
||||||
$e = preg_replace('/^ERR /', '', $redis->getLastError());
|
|
||||||
throw new InvalidArgumentException(sprintf('Redis connection "%s" failed: ', $dsn).$e.'.');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (0 < $params['tcp_keepalive'] && \defined('Redis::OPT_TCP_KEEPALIVE')) {
|
|
||||||
$redis->setOption(\Redis::OPT_TCP_KEEPALIVE, $params['tcp_keepalive']);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -174,9 +174,9 @@ class FlattenExceptionTest extends TestCase
|
|||||||
|
|
||||||
$flattened = FlattenException::create($exception)->getPrevious();
|
$flattened = FlattenException::create($exception)->getPrevious();
|
||||||
|
|
||||||
$this->assertEquals($flattened->getMessage(), 'Oh noes!', 'The message is copied from the original exception.');
|
$this->assertEquals('Oh noes!', $flattened->getMessage(), 'The message is copied from the original exception.');
|
||||||
$this->assertEquals($flattened->getCode(), 42, 'The code is copied from the original exception.');
|
$this->assertEquals(42, $flattened->getCode(), 'The code is copied from the original exception.');
|
||||||
$this->assertEquals($flattened->getClass(), 'ParseError', 'The class is set to the class of the original exception');
|
$this->assertEquals('ParseError', $flattened->getClass(), 'The class is set to the class of the original exception');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -300,7 +300,7 @@ class FlattenExceptionTest extends TestCase
|
|||||||
$this->assertSame(['float', INF], $array[$i++]);
|
$this->assertSame(['float', INF], $array[$i++]);
|
||||||
|
|
||||||
// assertEquals() does not like NAN values.
|
// assertEquals() does not like NAN values.
|
||||||
$this->assertEquals($array[$i][0], 'float');
|
$this->assertEquals('float', $array[$i][0]);
|
||||||
$this->assertNan($array[$i][1]);
|
$this->assertNan($array[$i][1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -879,12 +879,12 @@ class ContainerBuilderTest extends TestCase
|
|||||||
->addTag('bar', ['bar' => 'bar'])
|
->addTag('bar', ['bar' => 'bar'])
|
||||||
->addTag('foo', ['foofoo' => 'foofoo'])
|
->addTag('foo', ['foofoo' => 'foofoo'])
|
||||||
;
|
;
|
||||||
$this->assertEquals($builder->findTaggedServiceIds('foo'), [
|
$this->assertEquals([
|
||||||
'foo' => [
|
'foo' => [
|
||||||
['foo' => 'foo'],
|
['foo' => 'foo'],
|
||||||
['foofoo' => 'foofoo'],
|
['foofoo' => 'foofoo'],
|
||||||
],
|
],
|
||||||
], '->findTaggedServiceIds() returns an array of service ids and its tag attributes');
|
], $builder->findTaggedServiceIds('foo'), '->findTaggedServiceIds() returns an array of service ids and its tag attributes');
|
||||||
$this->assertEquals([], $builder->findTaggedServiceIds('foobar'), '->findTaggedServiceIds() returns an empty array if there is annotated services');
|
$this->assertEquals([], $builder->findTaggedServiceIds('foobar'), '->findTaggedServiceIds() returns an empty array if there is annotated services');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,10 +280,10 @@ class DefinitionTest extends TestCase
|
|||||||
$def->addTag('foo', ['foo' => 'bar']);
|
$def->addTag('foo', ['foo' => 'bar']);
|
||||||
$this->assertEquals([[], ['foo' => 'bar']], $def->getTag('foo'), '->addTag() can adds the same tag several times');
|
$this->assertEquals([[], ['foo' => 'bar']], $def->getTag('foo'), '->addTag() can adds the same tag several times');
|
||||||
$def->addTag('bar', ['bar' => 'bar']);
|
$def->addTag('bar', ['bar' => 'bar']);
|
||||||
$this->assertEquals($def->getTags(), [
|
$this->assertEquals([
|
||||||
'foo' => [[], ['foo' => 'bar']],
|
'foo' => [[], ['foo' => 'bar']],
|
||||||
'bar' => [['bar' => 'bar']],
|
'bar' => [['bar' => 'bar']],
|
||||||
], '->getTags() returns all tags');
|
], $def->getTags(), '->getTags() returns all tags');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSetArgument()
|
public function testSetArgument()
|
||||||
|
@ -170,25 +170,28 @@ class FormTest extends TestCase
|
|||||||
');
|
');
|
||||||
|
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
array_keys($form->all()),
|
['foo[2]', 'foo[3]', 'bar[foo][0]', 'bar[foo][foobar]'],
|
||||||
['foo[2]', 'foo[3]', 'bar[foo][0]', 'bar[foo][foobar]']
|
array_keys($form->all())
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertEquals($form->get('foo[2]')->getValue(), 'foo');
|
$this->assertEquals('foo', $form->get('foo[2]')->getValue());
|
||||||
$this->assertEquals($form->get('foo[3]')->getValue(), 'foo');
|
$this->assertEquals('foo', $form->get('foo[3]')->getValue());
|
||||||
$this->assertEquals($form->get('bar[foo][0]')->getValue(), 'foo');
|
$this->assertEquals('foo', $form->get('bar[foo][0]')->getValue());
|
||||||
$this->assertEquals($form->get('bar[foo][foobar]')->getValue(), 'foo');
|
$this->assertEquals('foo', $form->get('bar[foo][foobar]')->getValue());
|
||||||
|
|
||||||
$form['foo[2]'] = 'bar';
|
$form['foo[2]'] = 'bar';
|
||||||
$form['foo[3]'] = 'bar';
|
$form['foo[3]'] = 'bar';
|
||||||
|
|
||||||
$this->assertEquals($form->get('foo[2]')->getValue(), 'bar');
|
$this->assertEquals('bar', $form->get('foo[2]')->getValue());
|
||||||
$this->assertEquals($form->get('foo[3]')->getValue(), 'bar');
|
$this->assertEquals('bar', $form->get('foo[3]')->getValue());
|
||||||
|
|
||||||
$form['bar'] = ['foo' => ['0' => 'bar', 'foobar' => 'foobar']];
|
$form['bar'] = ['foo' => ['0' => 'bar', 'foobar' => 'foobar']];
|
||||||
|
|
||||||
$this->assertEquals($form->get('bar[foo][0]')->getValue(), 'bar');
|
$this->assertEquals('bar', $form->get('bar[foo][0]')->getValue());
|
||||||
$this->assertEquals($form->get('bar[foo][foobar]')->getValue(), 'foobar');
|
$this->assertEquals(
|
||||||
|
'foobar',
|
||||||
|
$form->get('bar[foo][foobar]')->getValue()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -979,7 +982,7 @@ class FormTest extends TestCase
|
|||||||
|
|
||||||
$nodes = $dom->getElementsByTagName('form');
|
$nodes = $dom->getElementsByTagName('form');
|
||||||
$form = new Form($nodes->item(0), 'http://example.com');
|
$form = new Form($nodes->item(0), 'http://example.com');
|
||||||
$this->assertEquals($form->getPhpValues(), ['example' => '']);
|
$this->assertEquals(['example' => ''], $form->getPhpValues());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetReturnTypes()
|
public function testGetReturnTypes()
|
||||||
|
@ -617,20 +617,20 @@ class ResponseTest extends ResponseTestCase
|
|||||||
|
|
||||||
$options = ['etag' => '"whatever"'];
|
$options = ['etag' => '"whatever"'];
|
||||||
$response->setCache($options);
|
$response->setCache($options);
|
||||||
$this->assertEquals($response->getEtag(), '"whatever"');
|
$this->assertEquals('"whatever"', $response->getEtag());
|
||||||
|
|
||||||
$now = $this->createDateTimeNow();
|
$now = $this->createDateTimeNow();
|
||||||
$options = ['last_modified' => $now];
|
$options = ['last_modified' => $now];
|
||||||
$response->setCache($options);
|
$response->setCache($options);
|
||||||
$this->assertEquals($response->getLastModified()->getTimestamp(), $now->getTimestamp());
|
$this->assertEquals($now->getTimestamp(), $response->getLastModified()->getTimestamp());
|
||||||
|
|
||||||
$options = ['max_age' => 100];
|
$options = ['max_age' => 100];
|
||||||
$response->setCache($options);
|
$response->setCache($options);
|
||||||
$this->assertEquals($response->getMaxAge(), 100);
|
$this->assertEquals(100, $response->getMaxAge());
|
||||||
|
|
||||||
$options = ['s_maxage' => 200];
|
$options = ['s_maxage' => 200];
|
||||||
$response->setCache($options);
|
$response->setCache($options);
|
||||||
$this->assertEquals($response->getMaxAge(), 200);
|
$this->assertEquals(200, $response->getMaxAge());
|
||||||
|
|
||||||
$this->assertTrue($response->headers->hasCacheControlDirective('public'));
|
$this->assertTrue($response->headers->hasCacheControlDirective('public'));
|
||||||
$this->assertFalse($response->headers->hasCacheControlDirective('private'));
|
$this->assertFalse($response->headers->hasCacheControlDirective('private'));
|
||||||
|
@ -86,7 +86,7 @@ class MongoDbSessionHandlerTest extends TestCase
|
|||||||
->method('findOne')
|
->method('findOne')
|
||||||
->willReturnCallback(function ($criteria) use ($testTimeout) {
|
->willReturnCallback(function ($criteria) use ($testTimeout) {
|
||||||
$this->assertArrayHasKey($this->options['id_field'], $criteria);
|
$this->assertArrayHasKey($this->options['id_field'], $criteria);
|
||||||
$this->assertEquals($criteria[$this->options['id_field']], 'foo');
|
$this->assertEquals('foo', $criteria[$this->options['id_field']]);
|
||||||
|
|
||||||
$this->assertArrayHasKey($this->options['expiry_field'], $criteria);
|
$this->assertArrayHasKey($this->options['expiry_field'], $criteria);
|
||||||
$this->assertArrayHasKey('$gte', $criteria[$this->options['expiry_field']]);
|
$this->assertArrayHasKey('$gte', $criteria[$this->options['expiry_field']]);
|
||||||
|
@ -83,10 +83,10 @@ class PhpBridgeSessionStorageTest extends TestCase
|
|||||||
$_SESSION['drak'] = 'loves symfony';
|
$_SESSION['drak'] = 'loves symfony';
|
||||||
$storage->getBag('attributes')->set('symfony', 'greatness');
|
$storage->getBag('attributes')->set('symfony', 'greatness');
|
||||||
$key = $storage->getBag('attributes')->getStorageKey();
|
$key = $storage->getBag('attributes')->getStorageKey();
|
||||||
$this->assertEquals($_SESSION[$key], ['symfony' => 'greatness']);
|
$this->assertEquals(['symfony' => 'greatness'], $_SESSION[$key]);
|
||||||
$this->assertEquals($_SESSION['drak'], 'loves symfony');
|
$this->assertEquals('loves symfony', $_SESSION['drak']);
|
||||||
$storage->clear();
|
$storage->clear();
|
||||||
$this->assertEquals($_SESSION[$key], []);
|
$this->assertEquals([], $_SESSION[$key]);
|
||||||
$this->assertEquals($_SESSION['drak'], 'loves symfony');
|
$this->assertEquals('loves symfony', $_SESSION['drak']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -205,9 +205,9 @@ class FileProfilerStorageTest extends TestCase
|
|||||||
|
|
||||||
$records = $this->storage->find('', '', 3, 'GET', $start, time() + 3 * 60);
|
$records = $this->storage->find('', '', 3, 'GET', $start, time() + 3 * 60);
|
||||||
$this->assertCount(3, $records, '->find() returns all previously added records');
|
$this->assertCount(3, $records, '->find() returns all previously added records');
|
||||||
$this->assertEquals($records[0]['token'], 'time_2', '->find() returns records ordered by time in descendant order');
|
$this->assertEquals('time_2', $records[0]['token'], '->find() returns records ordered by time in descendant order');
|
||||||
$this->assertEquals($records[1]['token'], 'time_1', '->find() returns records ordered by time in descendant order');
|
$this->assertEquals('time_1', $records[1]['token'], '->find() returns records ordered by time in descendant order');
|
||||||
$this->assertEquals($records[2]['token'], 'time_0', '->find() returns records ordered by time in descendant order');
|
$this->assertEquals('time_0', $records[2]['token'], '->find() returns records ordered by time in descendant order');
|
||||||
|
|
||||||
$records = $this->storage->find('', '', 3, 'GET', $start, time() + 2 * 60);
|
$records = $this->storage->find('', '', 3, 'GET', $start, time() + 2 * 60);
|
||||||
$this->assertCount(2, $records, '->find() should return only first two of the previously added records');
|
$this->assertCount(2, $records, '->find() should return only first two of the previously added records');
|
||||||
|
@ -94,12 +94,12 @@ class AdapterTest extends LdapTestCase
|
|||||||
$ldap->getConnection()->bind('cn=admin,dc=symfony,dc=com', 'symfony');
|
$ldap->getConnection()->bind('cn=admin,dc=symfony,dc=com', 'symfony');
|
||||||
|
|
||||||
$query = $ldap->createQuery('cn=Fabien Potencier,dc=symfony,dc=com', '(objectclass=*)', [
|
$query = $ldap->createQuery('cn=Fabien Potencier,dc=symfony,dc=com', '(objectclass=*)', [
|
||||||
'scope' => Query::SCOPE_BASE,
|
'scope' => Query::SCOPE_BASE,
|
||||||
]);
|
]);
|
||||||
$result = $query->execute();
|
$result = $query->execute();
|
||||||
|
|
||||||
$entry = $result[0];
|
$entry = $result[0];
|
||||||
$this->assertEquals($result->count(), 1);
|
$this->assertEquals(1, $result->count());
|
||||||
$this->assertEquals(['Fabien Potencier'], $entry->getAttribute('cn'));
|
$this->assertEquals(['Fabien Potencier'], $entry->getAttribute('cn'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,8 +116,8 @@ class AdapterTest extends LdapTestCase
|
|||||||
$subtree_count = $ldap->createQuery('ou=Components,dc=symfony,dc=com', '(objectclass=*)')->execute()->count();
|
$subtree_count = $ldap->createQuery('ou=Components,dc=symfony,dc=com', '(objectclass=*)')->execute()->count();
|
||||||
|
|
||||||
$this->assertNotEquals($one_level_result->count(), $subtree_count);
|
$this->assertNotEquals($one_level_result->count(), $subtree_count);
|
||||||
$this->assertEquals($one_level_result->count(), 1);
|
$this->assertEquals(1, $one_level_result->count());
|
||||||
$this->assertEquals($one_level_result[0]->getAttribute('ou'), ['Ldap']);
|
$this->assertEquals(['Ldap'], $one_level_result[0]->getAttribute('ou'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testLdapPagination()
|
public function testLdapPagination()
|
||||||
|
@ -186,7 +186,7 @@ class LdapManagerTest extends LdapTestCase
|
|||||||
|
|
||||||
$result = $this->executeSearchQuery(1);
|
$result = $this->executeSearchQuery(1);
|
||||||
$renamedEntry = $result[0];
|
$renamedEntry = $result[0];
|
||||||
$this->assertEquals($renamedEntry->getAttribute('cn')[0], 'Kevin');
|
$this->assertEquals('Kevin', $renamedEntry->getAttribute('cn')[0]);
|
||||||
|
|
||||||
$oldRdn = $entry->getAttribute('cn')[0];
|
$oldRdn = $entry->getAttribute('cn')[0];
|
||||||
$entryManager->rename($renamedEntry, 'cn='.$oldRdn);
|
$entryManager->rename($renamedEntry, 'cn='.$oldRdn);
|
||||||
|
@ -41,9 +41,9 @@ class PhpExecutableFinderTest extends TestCase
|
|||||||
$f = new PhpExecutableFinder();
|
$f = new PhpExecutableFinder();
|
||||||
|
|
||||||
if ('phpdbg' === \PHP_SAPI) {
|
if ('phpdbg' === \PHP_SAPI) {
|
||||||
$this->assertEquals($f->findArguments(), ['-qrr'], '::findArguments() returns phpdbg arguments');
|
$this->assertEquals(['-qrr'], $f->findArguments(), '::findArguments() returns phpdbg arguments');
|
||||||
} else {
|
} else {
|
||||||
$this->assertEquals($f->findArguments(), [], '::findArguments() returns no arguments');
|
$this->assertEquals([], $f->findArguments(), '::findArguments() returns no arguments');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,9 +180,9 @@ class PhpEngineTest extends TestCase
|
|||||||
|
|
||||||
$this->loader->setTemplate('global.php', '<?php echo $global; ?>');
|
$this->loader->setTemplate('global.php', '<?php echo $global; ?>');
|
||||||
|
|
||||||
$this->assertEquals($engine->render('global.php'), 'global variable');
|
$this->assertEquals('global variable', $engine->render('global.php'));
|
||||||
|
|
||||||
$this->assertEquals($engine->render('global.php', ['global' => 'overwritten']), 'overwritten');
|
$this->assertEquals('overwritten', $engine->render('global.php', ['global' => 'overwritten']));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetLoader()
|
public function testGetLoader()
|
||||||
|
@ -100,9 +100,9 @@ class PluralizationRulesTest extends TestCase
|
|||||||
foreach ($matrix as $langCode => $data) {
|
foreach ($matrix as $langCode => $data) {
|
||||||
$indexes = array_flip($data);
|
$indexes = array_flip($data);
|
||||||
if ($expectSuccess) {
|
if ($expectSuccess) {
|
||||||
$this->assertEquals($nplural, \count($indexes), "Langcode '$langCode' has '$nplural' plural forms.");
|
$this->assertCount((int) $nplural, $indexes, "Langcode '$langCode' has '$nplural' plural forms.");
|
||||||
} else {
|
} else {
|
||||||
$this->assertNotEquals((int) $nplural, \count($indexes), "Langcode '$langCode' has '$nplural' plural forms.");
|
$this->assertNotCount((int) $nplural, $indexes, "Langcode '$langCode' has '$nplural' plural forms.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user