Skip to content

Commit

Permalink
refactor: adapt CI
Browse files Browse the repository at this point in the history
  • Loading branch information
deguif committed Feb 4, 2025
1 parent 689aa7a commit 2f7c751
Show file tree
Hide file tree
Showing 20 changed files with 51 additions and 23 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,25 @@ jobs:
coverage: "pcov"
ini-values: "zend.assertions=1"

- name: Remove sensio/framework-extra-bundle
uses: php-actions/composer@v6
if: matrix.symfony-version == '^7.2'
with:
command: remove
args: --dev sensio/framework-extra-bundle --no-update

- name: Configure symfony version
uses: php-actions/composer@v6
with:
command: config
args: extra.symfony.require ${{ matrix.symfony-version }}

- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v1"
uses: "ramsey/composer-install@v3"
with:
dependency-versions: "${{ matrix.dependencies }}"
composer-options: "${{ matrix.composer-options }}"

- name: Run tests
run: |
SYMFONY_DEPRECATIONS_HELPER=weak vendor/bin/simple-phpunit ${PHPUNIT_FLAGS}
SYMFONY_PHPUNIT_VERSION=11.5 SYMFONY_DEPRECATIONS_HELPER=weak vendor/bin/simple-phpunit ${PHPUNIT_FLAGS}
9 changes: 7 additions & 2 deletions Tests/Functional/AppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,18 @@ public function __construct(string $fwConfig, ?string $config)

public function registerBundles(): iterable
{
return [
$bundles = [
new TestBundle(),
new FrameworkBundle(),
new TwigBundle(),
new JMSTranslationBundle(),
new SensioFrameworkExtraBundle(),
];

if (class_exists(SensioFrameworkExtraBundle::class)) {
$bundles[] = new SensioFrameworkExtraBundle();
}

return $bundles;
}

public function registerContainerConfiguration(LoaderInterface $loader): void
Expand Down
4 changes: 3 additions & 1 deletion Tests/Functional/BaseTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ protected static function createKernel(array $options = []): KernelInterface

$default = $isSf5 ? 'default_sf5.yml' : 'default.yml';

if (version_compare(Kernel::VERSION, '6.0.0') >= 0) {
if (version_compare(Kernel::VERSION, '7.0.0') >= 0) {
$conf = 'framework_sf7.yaml';
} elseif (version_compare(Kernel::VERSION, '6.0.0') >= 0) {
$conf = 'framework_sf6.yml';
} elseif (version_compare(Kernel::VERSION, '5.0.0') >= 0) {
$conf = 'framework.yml';
Expand Down
2 changes: 1 addition & 1 deletion Tests/Functional/Controller/ApiControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class ApiControllerTest extends BaseTestCase
public function testUpdateAction(): void
{
// Start application
$client = static::createClient(['config' => 'test_updating_translations.yml']);
$client = static::createClient();
$outputDir = $client->getContainer()->getParameter('translation_output_dir');

$isSf4 = version_compare(Kernel::VERSION, '4.0.0') >= 0;
Expand Down
17 changes: 17 additions & 0 deletions Tests/Functional/config/framework_sf7.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
framework:
secret: test
http_method_override: true
test: ~
assets: ~
session:
storage_factory_id: session.storage.factory.mock_file
form: true
csrf_protection: true
annotations: false
property_access: true
validation:
enabled: true
translator:
enabled: true
router:
resource: "%kernel.project_dir%/config/routing_sf6.yaml"
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
use JMS\TranslationBundle\Model\MessageCatalogue;
use PHPUnit\Framework\TestCase;

abstract class BaseDumperTest extends TestCase
abstract class DumperTestCase extends TestCase
{
public function testSimpleDump(): void
{
Expand Down
2 changes: 1 addition & 1 deletion Tests/Translation/Dumper/PhpDumperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
use JMS\TranslationBundle\Model\MessageCatalogue;
use JMS\TranslationBundle\Translation\Dumper\PhpDumper;

class PhpDumperTest extends BaseDumperTest
class PhpDumperTest extends DumperTestCase
{
public function testDumpStructureWithoutPrettyPrint(): void
{
Expand Down
2 changes: 1 addition & 1 deletion Tests/Translation/Dumper/XliffDumperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
use JMS\TranslationBundle\Model\MessageCatalogue;
use JMS\TranslationBundle\Translation\Dumper\XliffDumper;

class XliffDumperTest extends BaseDumperTest
class XliffDumperTest extends DumperTestCase
{
public function testCdataOutput(): void
{
Expand Down
2 changes: 1 addition & 1 deletion Tests/Translation/Dumper/YamlDumperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
use JMS\TranslationBundle\Model\MessageCatalogue;
use JMS\TranslationBundle\Translation\Dumper\YamlDumper;

class YamlDumperTest extends BaseDumperTest
class YamlDumperTest extends DumperTestCase
{
public function testDumpStructureWithoutPrettyPrint(): void
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
use JMS\TranslationBundle\Model\MessageCatalogue;
use JMS\TranslationBundle\Translation\Extractor\File\AuthenticationMessagesExtractor;

class AuthenticationMessagesExtractorTest extends BasePhpFileExtractorTest
class AuthenticationMessagesExtractorTest extends PhpFileExtractorTestCase
{
public function testExtract(): void
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
use JMS\TranslationBundle\Model\MessageCatalogue;
use JMS\TranslationBundle\Translation\Extractor\File\DefaultPhpFileExtractor;

class DefaultPhpFileExtractorTest extends BasePhpFileExtractorTest
class DefaultPhpFileExtractorTest extends PhpFileExtractorTestCase
{
public function testExtractController(): void
{
Expand Down
4 changes: 1 addition & 3 deletions Tests/Translation/Extractor/File/Fixture/MyFormModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ class MyFormModel implements TranslationContainerInterface
'bar' => 'form.label.choice.bar',
];

/**
* @Assert\NotBlank(message = "form.error.name_required")
*/
#[Assert\NotBlank(message: "form.error.name_required")]
public $name;

public static function getTranslationMessages()
Expand Down
2 changes: 1 addition & 1 deletion Tests/Translation/Extractor/File/FormExtractorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
use JMS\TranslationBundle\Model\MessageCatalogue;
use JMS\TranslationBundle\Translation\Extractor\File\FormExtractor;

class FormExtractorTest extends BasePhpFileExtractorTest
class FormExtractorTest extends PhpFileExtractorTestCase
{
/**
* @group placeholder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
use PhpParser\ParserFactory;
use PHPUnit\Framework\TestCase;

abstract class BasePhpFileExtractorTest extends TestCase
abstract class PhpFileExtractorTestCase extends TestCase
{
final protected function extract($file, ?FileVisitorInterface $extractor = null): MessageCatalogue
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
use Symfony\Component\Translation\Loader\LoaderInterface;
use Symfony\Component\Translation\MessageCatalogue;

abstract class BaseLoaderTest extends TestCase
abstract class LoaderTestCase extends TestCase
{
public function testLoadSimple(): void
{
Expand Down
2 changes: 1 addition & 1 deletion Tests/Translation/Loader/Symfony/PhpLoaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
use JMS\TranslationBundle\Exception\InvalidArgumentException;
use Symfony\Component\Translation\Loader\PhpFileLoader;

class PhpLoaderTest extends BaseLoaderTest
class PhpLoaderTest extends LoaderTestCase
{
protected function getLoader(): PhpFileLoader
{
Expand Down
2 changes: 1 addition & 1 deletion Tests/Translation/Loader/Symfony/XliffLoaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\Translation\MessageCatalogue;

class XliffLoaderTest extends BaseLoaderTest
class XliffLoaderTest extends LoaderTestCase
{
public function testLoadOldFormat(): void
{
Expand Down
2 changes: 1 addition & 1 deletion Tests/Translation/Loader/Symfony/YamlLoaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
use JMS\TranslationBundle\Exception\InvalidArgumentException;
use Symfony\Component\Translation\Loader\YamlFileLoader;

class YamlLoaderTest extends BaseLoaderTest
class YamlLoaderTest extends LoaderTestCase
{
protected function getLoader(): YamlFileLoader
{
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"doctrine/coding-standard": "^9.0",
"matthiasnoback/symfony-dependency-injection-test": "^5.1",
"nyholm/nsa": "^1.0.1",
"symfony/phpunit-bridge": "^5.4 || ^6.4 || ^7.1",
"symfony/phpunit-bridge": "^7.2",
"sensio/framework-extra-bundle": "^6.2.4",
"symfony/asset": "^5.4 || ^6.4 || ^7.1",
"symfony/browser-kit": "^5.4 || ^6.4 || ^7.1",
Expand Down
1 change: 0 additions & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
stopOnFailure="false"
bootstrap="Tests/bootstrap.php"
>

<testsuites>
<testsuite name="JMSTranslationBundle Test Suite">
<directory>./Tests</directory>
Expand Down

0 comments on commit 2f7c751

Please sign in to comment.