Skip to content

Commit

Permalink
Allow Symfony 7 support (#65)
Browse files Browse the repository at this point in the history
* 🐛 Allow sf7 and fix tests

* 🐛 Fix test
  • Loading branch information
damienlagae authored Jan 29, 2024
1 parent 6983039 commit 20f9141
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
"require": {
"php": "^7.2 || ^8.0",
"php-translation/common": "^3.0",
"symfony/translation": "^3.4 || ^4.2 || ^5.0 || ^6.0"
"symfony/translation": "^3.4 || ^4.2 || ^5.0 || ^6.0 || ^7.0"
},
"require-dev": {
"phpunit/phpunit": ">=8.5.20",
"symfony/framework-bundle": " ^3.4 || ^4.2 || ^5.0 || ^6.0"
"symfony/framework-bundle": " ^3.4 || ^4.2 || ^5.0 || ^6.0 || ^7.0"
},
"autoload": {
"psr-4": {
Expand Down
12 changes: 6 additions & 6 deletions tests/Unit/FileStorageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function testConstructorEmptyArray()
public function testCreateNewCatalogue()
{
$writer = $this->getMockBuilder(TranslationWriter::class)
->setMethods([$this->getMethodNameToWriteTranslations()])
->onlyMethods([$this->getMethodNameToWriteTranslations()])
->disableOriginalConstructor()
->getMock();
$writer->expects($this->once())
Expand All @@ -56,7 +56,7 @@ public function testCreateNewCatalogue()
$storage->create(new Message('key', 'domain', 'en', 'Message'));

$writer = $this->getMockBuilder(TranslationWriter::class)
->setMethods([$this->getMethodNameToWriteTranslations()])
->onlyMethods([$this->getMethodNameToWriteTranslations()])
->disableOriginalConstructor()
->getMock();
$writer->expects($this->once())
Expand All @@ -74,7 +74,7 @@ public function testCreateNewCatalogue()
public function testCreateExistingCatalogue()
{
$writer = $this->getMockBuilder(TranslationWriter::class)
->setMethods([$this->getMethodNameToWriteTranslations()])
->onlyMethods([$this->getMethodNameToWriteTranslations()])
->disableOriginalConstructor()
->getMock();
$writer->expects($this->once())
Expand Down Expand Up @@ -117,7 +117,7 @@ public function testGet()
public function testUpdate()
{
$writer = $this->getMockBuilder(TranslationWriter::class)
->setMethods([$this->getMethodNameToWriteTranslations()])
->onlyMethods([$this->getMethodNameToWriteTranslations()])
->disableOriginalConstructor()
->getMock();
$writer->expects($this->exactly(2))
Expand All @@ -139,7 +139,7 @@ public function testUpdate()
public function testDelete()
{
$writer = $this->getMockBuilder(TranslationWriter::class)
->setMethods([$this->getMethodNameToWriteTranslations()])
->onlyMethods([$this->getMethodNameToWriteTranslations()])
->disableOriginalConstructor()
->getMock();

Expand All @@ -163,7 +163,7 @@ public function testDelete()
public function testImport()
{
$writer = $this->getMockBuilder(TranslationWriter::class)
->setMethods([$this->getMethodNameToWriteTranslations()])
->onlyMethods([$this->getMethodNameToWriteTranslations()])
->disableOriginalConstructor()
->getMock();

Expand Down
7 changes: 6 additions & 1 deletion tests/Unit/XliffConverterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ public function testCatalogueToContent()
$catalogue->add(['foobar' => 'bar']);
$content = XliffConverter::catalogueToContent($catalogue, 'messages');

$this->assertRegExp('|foobar|', $content);
// If PHPUnit 9.0 or higher is used, use assertMatchesRegularExpression() instead
if (method_exists($this, 'assertMatchesRegularExpression')) {
$this->assertMatchesRegularExpression('/foobar/', $content);
} else {
$this->assertRegExp('|foobar|', $content);
}
}
}

0 comments on commit 20f9141

Please sign in to comment.