Skip to content

Commit c5874d1

Browse files
Allow Symfony 7 support (#52)
* Allow Symfony 7 support * Symfony 7 support (#54) * 🐛 Add prophecy-phpunit (v10) * 🐛 Fix assert regex * 🐛 Fix setMethods --------- Co-authored-by: Damien Lagae <damienlagae@gmail.com>
1 parent a8e1d83 commit c5874d1

File tree

4 files changed

+13
-10
lines changed

4 files changed

+13
-10
lines changed

composer.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@
1010
],
1111
"require": {
1212
"php": ">=7.2",
13-
"symfony/translation": " ^3.4 || ^4.3 || ^5.0 || ^6.0"
13+
"symfony/translation": " ^3.4 || ^4.3 || ^5.0 || ^6.0 || ^7.0"
1414
},
1515
"require-dev": {
16-
"symfony/framework-bundle": " ^3.4 || ^4.3 || ^5.0 || ^6.0",
17-
"phpunit/phpunit": ">=8.5.23"
16+
"symfony/framework-bundle": " ^3.4 || ^4.3 || ^5.0 || ^6.0 || ^7.0",
17+
"phpunit/phpunit": ">=8.5.23",
18+
"phpspec/prophecy-phpunit": "^2.1"
1819
},
1920
"autoload": {
2021
"psr-4": {

tests/Unit/Storage/ChainStorageTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@
1212
namespace Translation\common\tests\Unit\Storage;
1313

1414
use PHPUnit\Framework\TestCase;
15+
use Prophecy\PhpUnit\ProphecyTrait;
1516
use Symfony\Component\Translation\MessageCatalogueInterface;
1617
use Translation\Common\Model\Message;
1718
use Translation\Common\Storage\ChainStorage;
1819
use Translation\Common\Storage\StorageInterface;
1920

2021
class ChainStorageTest extends TestCase
2122
{
23+
use ProphecyTrait;
2224
private $childStorage1;
2325
private $childStorage2;
2426
private $storage;

tests/Unit/Storage/FileStorageTest.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function testConstructorEmptyArray()
4141
public function testCreateNewCatalogue()
4242
{
4343
$writer = $this->getMockBuilder(TranslationWriter::class)
44-
->setMethods([$this->getMethodNameToWriteTranslations()])
44+
->onlyMethods([$this->getMethodNameToWriteTranslations()])
4545
->disableOriginalConstructor()
4646
->getMock();
4747
$writer->expects($this->once())
@@ -56,7 +56,7 @@ public function testCreateNewCatalogue()
5656
$storage->create(new Message('key', 'domain', 'en', 'Message'));
5757

5858
$writer = $this->getMockBuilder(TranslationWriter::class)
59-
->setMethods([$this->getMethodNameToWriteTranslations()])
59+
->onlyMethods([$this->getMethodNameToWriteTranslations()])
6060
->disableOriginalConstructor()
6161
->getMock();
6262
$writer->expects($this->once())
@@ -74,7 +74,7 @@ public function testCreateNewCatalogue()
7474
public function testCreateExistingCatalogue()
7575
{
7676
$writer = $this->getMockBuilder(TranslationWriter::class)
77-
->setMethods([$this->getMethodNameToWriteTranslations()])
77+
->onlyMethods([$this->getMethodNameToWriteTranslations()])
7878
->disableOriginalConstructor()
7979
->getMock();
8080
$writer->expects($this->once())
@@ -117,7 +117,7 @@ public function testGet()
117117
public function testUpdate()
118118
{
119119
$writer = $this->getMockBuilder(TranslationWriter::class)
120-
->setMethods([$this->getMethodNameToWriteTranslations()])
120+
->onlyMethods([$this->getMethodNameToWriteTranslations()])
121121
->disableOriginalConstructor()
122122
->getMock();
123123
$writer->expects($this->exactly(2))
@@ -139,7 +139,7 @@ public function testUpdate()
139139
public function testDelete()
140140
{
141141
$writer = $this->getMockBuilder(TranslationWriter::class)
142-
->setMethods([$this->getMethodNameToWriteTranslations()])
142+
->onlyMethods([$this->getMethodNameToWriteTranslations()])
143143
->disableOriginalConstructor()
144144
->getMock();
145145

@@ -163,7 +163,7 @@ public function testDelete()
163163
public function testImport()
164164
{
165165
$writer = $this->getMockBuilder(TranslationWriter::class)
166-
->setMethods([$this->getMethodNameToWriteTranslations()])
166+
->onlyMethods([$this->getMethodNameToWriteTranslations()])
167167
->disableOriginalConstructor()
168168
->getMock();
169169

tests/Unit/XliffConverterTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@ public function testCatalogueToContent()
3636
$catalogue->add(['foobar' => 'bar']);
3737
$content = XliffConverter::catalogueToContent($catalogue, 'messages');
3838

39-
$this->assertRegExp('|foobar|', $content);
39+
$this->assertMatchesRegularExpression('/foobar/', $content);
4040
}
4141
}

0 commit comments

Comments
 (0)