Skip to content

Commit 6558ada

Browse files
[tests] Use @requires annotation when possible
1 parent 4031c4c commit 6558ada

File tree

5 files changed

+13
-23
lines changed

5 files changed

+13
-23
lines changed

Tests/Dumper/IcuResFileDumperTest.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,11 @@
1616

1717
class IcuResFileDumperTest extends \PHPUnit_Framework_TestCase
1818
{
19+
/**
20+
* @requires extension mbstring
21+
*/
1922
public function testDump()
2023
{
21-
if (!function_exists('mb_convert_encoding')) {
22-
$this->markTestSkipped('This test requires mbstring to work.');
23-
}
24-
2524
$catalogue = new MessageCatalogue('en');
2625
$catalogue->add(array('foo' => 'bar'));
2726

Tests/Loader/IcuDatFileLoaderTest.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,11 @@
1414
use Symfony\Component\Translation\Loader\IcuDatFileLoader;
1515
use Symfony\Component\Config\Resource\FileResource;
1616

17+
/**
18+
* @requires extension intl
19+
*/
1720
class IcuDatFileLoaderTest extends LocalizedTestCase
1821
{
19-
protected function setUp()
20-
{
21-
if (!extension_loaded('intl')) {
22-
$this->markTestSkipped('This test requires intl extension to work.');
23-
}
24-
}
25-
2622
/**
2723
* @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException
2824
*/

Tests/Loader/IcuResFileLoaderTest.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,11 @@
1414
use Symfony\Component\Translation\Loader\IcuResFileLoader;
1515
use Symfony\Component\Config\Resource\DirectoryResource;
1616

17+
/**
18+
* @requires extension intl
19+
*/
1720
class IcuResFileLoaderTest extends LocalizedTestCase
1821
{
19-
protected function setUp()
20-
{
21-
if (!extension_loaded('intl')) {
22-
$this->markTestSkipped('This test requires intl extension to work.');
23-
}
24-
}
25-
2622
public function testLoad()
2723
{
2824
// resource is build using genrb command

Tests/Loader/LocalizedTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ abstract class LocalizedTestCase extends \PHPUnit_Framework_TestCase
1616
protected function setUp()
1717
{
1818
if (!extension_loaded('intl')) {
19-
$this->markTestSkipped('The "intl" extension is not available');
19+
$this->markTestSkipped('Extension intl is required.');
2020
}
2121
}
2222
}

Tests/Loader/XliffFileLoaderTest.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,11 @@ public function testIncompleteResource()
5959
$this->assertEquals(array('foo' => 'bar', 'extra' => 'extra', 'key' => '', 'test' => 'with'), $catalogue->all('domain1'));
6060
}
6161

62+
/**
63+
* @requires extension mbstring
64+
*/
6265
public function testEncoding()
6366
{
64-
if (!function_exists('iconv') && !function_exists('mb_convert_encoding')) {
65-
$this->markTestSkipped('The iconv and mbstring extensions are not available.');
66-
}
67-
6867
$loader = new XliffFileLoader();
6968
$catalogue = $loader->load(__DIR__.'/../fixtures/encoding.xlf', 'en', 'domain1');
7069

0 commit comments

Comments
 (0)