Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHPUnit forward compatibility layer #858

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"mrclay/minify": "<2.3",
"natxet/cssmin": "3.0.4",
"patchwork/jsqueeze": "~1.0|~2.0",
"phpunit/phpunit": "~4.8 || ^5.6",
"phpunit/phpunit": "^4.8.35 || ^5.7",
"psr/log": "~1.0",
"ptachoire/cssembed": "~1.0",
"symfony/phpunit-bridge": "~2.7|~3.0",
Expand Down
3 changes: 2 additions & 1 deletion tests/Assetic/Test/Asset/AssetCacheTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
namespace Assetic\Test\Asset;

use Assetic\Asset\AssetCache;
use PHPUnit\Framework\TestCase;

class AssetCacheTest extends \PHPUnit_Framework_TestCase
class AssetCacheTest extends TestCase
{
private $inner;
private $cache;
Expand Down
7 changes: 4 additions & 3 deletions tests/Assetic/Test/Asset/AssetCollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
use Assetic\Asset\FileAsset;
use Assetic\Asset\AssetCollection;
use Assetic\Filter\CallablesFilter;
use PHPUnit\Framework\TestCase;

class AssetCollectionTest extends \PHPUnit_Framework_TestCase
class AssetCollectionTest extends TestCase
{
public function testInterface()
{
Expand Down Expand Up @@ -309,7 +310,7 @@ public function testRemoveRecursiveLeaf()

public function testRemoveInvalidLeaf()
{
$this->setExpectedException('InvalidArgumentException');
$this->expectException('InvalidArgumentException');

$coll = new AssetCollection();
$coll->removeLeaf(new StringAsset('asdf'));
Expand Down Expand Up @@ -337,7 +338,7 @@ public function testReplaceRecursiveLeaf()

public function testReplaceInvalidLeaf()
{
$this->setExpectedException('InvalidArgumentException');
$this->expectException('InvalidArgumentException');

$coll = new AssetCollection();
$coll->replaceLeaf(new StringAsset('foo'), new StringAsset('bar'));
Expand Down
3 changes: 2 additions & 1 deletion tests/Assetic/Test/Asset/AssetReferenceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@

use Assetic\Asset\AssetReference;
use Assetic\Asset\StringAsset;
use PHPUnit\Framework\TestCase;

class AssetReferenceTest extends \PHPUnit_Framework_TestCase
class AssetReferenceTest extends TestCase
{
private $am;
private $ref;
Expand Down
9 changes: 6 additions & 3 deletions tests/Assetic/Test/Asset/FileAssetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
namespace Assetic\Test\Asset;

use Assetic\Asset\FileAsset;
use PHPUnit\Framework\TestCase;

class FileAssetTest extends \PHPUnit_Framework_TestCase
class FileAssetTest extends TestCase
{
public function testInterface()
{
Expand All @@ -40,7 +41,9 @@ public function testGetLastModifiedTypeFileNotFound()
{
$asset = new FileAsset(__DIR__."/foo/bar/baz.css");

$this->setExpectedException("RuntimeException", "The source file");
$this->expectException("RuntimeException");
$this->expectExceptionMessage("The source file");

$asset->getLastModified();
}

Expand All @@ -67,7 +70,7 @@ public function testPathGuessing()

public function testInvalidBase()
{
$this->setExpectedException('InvalidArgumentException');
$this->expectException('InvalidArgumentException');

$asset = new FileAsset(__FILE__, array(), __DIR__.'/foo');
}
Expand Down
3 changes: 2 additions & 1 deletion tests/Assetic/Test/Asset/GlobAssetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@

use Assetic\Asset\GlobAsset;
use Assetic\Util\VarUtils;
use PHPUnit\Framework\TestCase;

class GlobAssetTest extends \PHPUnit_Framework_TestCase
class GlobAssetTest extends TestCase
{
public function testInterface()
{
Expand Down
7 changes: 4 additions & 3 deletions tests/Assetic/Test/Asset/HttpAssetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
namespace Assetic\Test\Asset;

use Assetic\Asset\HttpAsset;
use PHPUnit\Framework\TestCase;

class HttpAssetTest extends \PHPUnit_Framework_TestCase
class HttpAssetTest extends TestCase
{
const JQUERY = 'http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js';

Expand All @@ -38,14 +39,14 @@ public function testProtocolRelativeUrl()

public function testMalformedUrl()
{
$this->setExpectedException('InvalidArgumentException');
$this->expectException('InvalidArgumentException');

new HttpAsset(__FILE__);
}

public function testInvalidUrl()
{
$this->setExpectedException('RuntimeException');
$this->expectException('RuntimeException');

$asset = new HttpAsset('http://invalid.com/foobar');
$asset->load();
Expand Down
3 changes: 2 additions & 1 deletion tests/Assetic/Test/Asset/StringAssetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
namespace Assetic\Test\Asset;

use Assetic\Asset\StringAsset;
use PHPUnit\Framework\TestCase;

class StringAssetTest extends \PHPUnit_Framework_TestCase
class StringAssetTest extends TestCase
{
public function testInterface()
{
Expand Down
7 changes: 4 additions & 3 deletions tests/Assetic/Test/AssetManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
namespace Assetic\Test;

use Assetic\AssetManager;
use PHPUnit\Framework\TestCase;

class AssetManagerTest extends \PHPUnit_Framework_TestCase
class AssetManagerTest extends TestCase
{
/** @var AssetManager */
private $am;
Expand All @@ -32,7 +33,7 @@ public function testGetAsset()

public function testGetInvalidAsset()
{
$this->setExpectedException('InvalidArgumentException');
$this->expectException('InvalidArgumentException');
$this->am->get('foo');
}

Expand All @@ -47,7 +48,7 @@ public function testHas()

public function testInvalidName()
{
$this->setExpectedException('InvalidArgumentException');
$this->expectException('InvalidArgumentException');

$this->am->set('@foo', $this->getMockBuilder('Assetic\\Asset\\AssetInterface')->getMock());
}
Expand Down
3 changes: 2 additions & 1 deletion tests/Assetic/Test/AssetWriterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@

use Assetic\Asset\FileAsset;
use Assetic\AssetWriter;
use PHPUnit\Framework\TestCase;

class AssetWriterTest extends \PHPUnit_Framework_TestCase
class AssetWriterTest extends TestCase
{
private $dir;
/** @var AssetWriter */
Expand Down
3 changes: 2 additions & 1 deletion tests/Assetic/Test/Cache/ApcCacheTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
namespace Assetic\Test\Cache;

use Assetic\Cache\ApcCache;
use PHPUnit\Framework\TestCase;

/**
* @group integration
*/
class ApcCacheTest extends \PHPUnit_Framework_TestCase
class ApcCacheTest extends TestCase
{
protected function setUp()
{
Expand Down
3 changes: 2 additions & 1 deletion tests/Assetic/Test/Cache/ArrayCacheTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
namespace Assetic\Test\Cache;

use Assetic\Cache\ArrayCache;
use PHPUnit\Framework\TestCase;

/**
* @group integration
*/
class ArrayCacheTest extends \PHPUnit_Framework_TestCase
class ArrayCacheTest extends TestCase
{
public function testCache()
{
Expand Down
4 changes: 2 additions & 2 deletions tests/Assetic/Test/Cache/ConfigCacheTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ public function testTimestamp()

public function testInvalidValue()
{
$this->setExpectedException('RuntimeException');
$this->expectException('RuntimeException');
$this->cache->get('_invalid');
}

public function testInvalidTimestamp()
{
$this->setExpectedException('RuntimeException');
$this->expectException('RuntimeException');
$this->cache->getTimestamp('_invalid');
}

Expand Down
3 changes: 2 additions & 1 deletion tests/Assetic/Test/Cache/ExpiringCacheTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
namespace Assetic\Test\Cache;

use Assetic\Cache\ExpiringCache;
use PHPUnit\Framework\TestCase;

class ExpiringCacheTest extends \PHPUnit_Framework_TestCase
class ExpiringCacheTest extends TestCase
{
private $inner;
private $lifetime;
Expand Down
3 changes: 2 additions & 1 deletion tests/Assetic/Test/Cache/FilesystemCacheTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
namespace Assetic\Test\Cache;

use Assetic\Cache\FilesystemCache;
use PHPUnit\Framework\TestCase;

class FilesystemCacheTest extends \PHPUnit_Framework_TestCase
class FilesystemCacheTest extends TestCase
{
public function testWithExistingDir()
{
Expand Down
3 changes: 2 additions & 1 deletion tests/Assetic/Test/Extension/Twig/AsseticExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
use Assetic\Extension\Twig\AsseticExtension;
use Assetic\Asset\AssetCollection;
use Assetic\Asset\FileAsset;
use PHPUnit\Framework\TestCase;

class AsseticExtensionTest extends \PHPUnit_Framework_TestCase
class AsseticExtensionTest extends TestCase
{
/**
* @var \PHPUnit_Framework_MockObject_MockObject|\Assetic\AssetManager
Expand Down
3 changes: 2 additions & 1 deletion tests/Assetic/Test/Extension/Twig/TwigFormulaLoaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
use Assetic\Factory\AssetFactory;
use Assetic\Extension\Twig\AsseticExtension;
use Assetic\Extension\Twig\TwigFormulaLoader;
use PHPUnit\Framework\TestCase;

class TwigFormulaLoaderTest extends \PHPUnit_Framework_TestCase
class TwigFormulaLoaderTest extends TestCase
{
private $am;
private $fm;
Expand Down
3 changes: 2 additions & 1 deletion tests/Assetic/Test/Extension/Twig/TwigResourceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
namespace Assetic\Test\Extension\Twig;

use Assetic\Extension\Twig\TwigResource;
use PHPUnit\Framework\TestCase;

class TwigResourceTest extends \PHPUnit_Framework_TestCase
class TwigResourceTest extends TestCase
{
protected function setUp()
{
Expand Down
12 changes: 8 additions & 4 deletions tests/Assetic/Test/Factory/AssetFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@

use Assetic\Asset\AssetCollection;
use Assetic\Factory\AssetFactory;
use PHPUnit\Framework\TestCase;

class AssetFactoryTest extends \PHPUnit_Framework_TestCase
class AssetFactoryTest extends TestCase
{
private $am;
private $fm;
Expand All @@ -39,7 +40,8 @@ protected function tearDown()

public function testNoAssetManagerReference()
{
$this->setExpectedException('LogicException', 'There is no asset manager.');
$this->expectException('LogicException');
$this->expectExceptionMessage('There is no asset manager.');

$factory = new AssetFactory('.');
$factory->createAsset(array('@foo'));
Expand All @@ -53,7 +55,9 @@ public function testNoAssetManagerNotReference()

public function testNoFilterManager()
{
$this->setExpectedException('LogicException', 'There is no filter manager.');
$this->expectException('LogicException');
$this->expectExceptionMessage('There is no filter manager.');


$factory = new AssetFactory('.');
$factory->createAsset(array('foo'), array('foo'));
Expand Down Expand Up @@ -141,7 +145,7 @@ public function testFilter()

public function testInvalidFilter()
{
$this->setExpectedException('InvalidArgumentException');
$this->expectException('InvalidArgumentException');

$this->fm->expects($this->once())
->method('get')
Expand Down
3 changes: 2 additions & 1 deletion tests/Assetic/Test/Factory/LazyAssetManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
namespace Assetic\Test\Factory;

use Assetic\Factory\LazyAssetManager;
use PHPUnit\Framework\TestCase;

class LazyAssetManagerTest extends \PHPUnit_Framework_TestCase
class LazyAssetManagerTest extends TestCase
{
private $factory;
private $am;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
namespace Assetic\Test\Factory\Loader;

use Assetic\Factory\Loader\CachedFormulaLoader;
use PHPUnit\Framework\TestCase;

class CachedFormulaLoaderTest extends \PHPUnit_Framework_TestCase
class CachedFormulaLoaderTest extends TestCase
{
protected $loader;
protected $configCache;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
use Assetic\Factory\AssetFactory;
use Assetic\Factory\Loader\FunctionCallsFormulaLoader;
use Assetic\Factory\Resource\FileResource;
use PHPUnit\Framework\TestCase;

class FunctionCallsFormulaLoaderTest extends \PHPUnit_Framework_TestCase
class FunctionCallsFormulaLoaderTest extends TestCase
{
/**
* @dataProvider getJavascriptInputs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@

use Assetic\Factory\Resource\CoalescingDirectoryResource;
use Assetic\Factory\Resource\DirectoryResource;
use PHPUnit\Framework\TestCase;

class CoalescingDirectoryResourceTest extends \PHPUnit_Framework_TestCase
class CoalescingDirectoryResourceTest extends TestCase
{
/**
* @test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
namespace Assetic\Test\Factory\Resource;

use Assetic\Factory\Resource\DirectoryResource;
use PHPUnit\Framework\TestCase;

class DirectoryResourceTest extends \PHPUnit_Framework_TestCase
class DirectoryResourceTest extends TestCase
{
public function testIsFresh()
{
Expand Down
3 changes: 2 additions & 1 deletion tests/Assetic/Test/Factory/Resource/FileResourceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
namespace Assetic\Test\Factory\Resource;

use Assetic\Factory\Resource\FileResource;
use PHPUnit\Framework\TestCase;

class FileResourceTest extends \PHPUnit_Framework_TestCase
class FileResourceTest extends TestCase
{
public function testIsFresh()
{
Expand Down
3 changes: 2 additions & 1 deletion tests/Assetic/Test/Factory/Worker/CacheBustingWorkerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
namespace Assetic\Test\Factory\Worker;

use Assetic\Factory\Worker\CacheBustingWorker;
use PHPUnit\Framework\TestCase;

class CacheBustingWorkerTest extends \PHPUnit_Framework_TestCase
class CacheBustingWorkerTest extends TestCase
{
private $worker;

Expand Down
Loading