Skip to content

Commit

Permalink
[4.x] PHPUnit 10 (#9529)
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonvarga authored Feb 15, 2024
1 parent 77c1aa3 commit d76a4b4
Show file tree
Hide file tree
Showing 152 changed files with 393 additions and 359 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
node_modules
.DS_Store
.phpunit.result.cache
.phpunit.cache
.php-cs-fixer.cache
tests/Fakes/Composer/Package/test-package/composer.json
resources/dist
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"laravel/pint": "^1.0",
"mockery/mockery": "^1.3.3",
"orchestra/testbench": "^7.0 || ^8.0",
"phpunit/phpunit": "^9.0"
"phpunit/phpunit": "^9.0 || ^10.0"
},
"config": {
"optimize-autoloader": true,
Expand Down
8 changes: 3 additions & 5 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
backupGlobals="false"
backupStaticAttributes="false"
backupStaticProperties="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
cacheDirectory=".phpunit.cache"
stopOnFailure="false">
<testsuites>
<testsuite name="Tests">
Expand Down
10 changes: 5 additions & 5 deletions tests/API/APITest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function it_handles_not_found_entries($url, $requestShouldSucceed)
}
}

public function entryNotFoundProvider()
public static function entryNotFoundProvider()
{
return [
'valid entry id' => ['/api/collections/pages/entries/about', true],
Expand All @@ -53,15 +53,15 @@ public function entryNotFoundProvider()
];
}

public function exampleFilters()
public static function exampleFiltersProvider()
{
return [['status:is'], ['published:is'], ['title:is']];
}

/**
* @test
*
* @dataProvider exampleFilters
* @dataProvider exampleFiltersProvider
*/
public function it_cannot_filter_entries_by_default($filter)
{
Expand Down Expand Up @@ -416,7 +416,7 @@ public function it_replaces_terms_using_live_preview_token()
]);
}

public function userPasswordFilterProvider()
public static function userPasswordFilterProvider()
{
return collect([
'password',
Expand Down Expand Up @@ -449,7 +449,7 @@ public function it_handles_not_found_terms($url, $requestShouldSucceed)
}
}

public function termNotFoundProvider()
public static function termNotFoundProvider()
{
return [
'valid term id' => ['/api/taxonomies/tags/terms/test', true],
Expand Down
2 changes: 1 addition & 1 deletion tests/API/CacherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public function it_doesnt_bypass_cache_when_using_an_invalid_token($endpoint, $h
$this->assertEquals([$cacheKey], Cache::get('api-cache:tracked-responses'));
}

public function bypassCacheProvider()
public static function bypassCacheProvider()
{
$endpoint = '/api/collections/articles/entries';

Expand Down
2 changes: 1 addition & 1 deletion tests/API/FilterAuthorizerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function setUp(): void
Facades\Form::make('newsletter')->save();
}

public function configFileProvider()
public static function configFileProvider()
{
return [
['api'],
Expand Down
2 changes: 1 addition & 1 deletion tests/API/ResourceAuthorizerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function setUp(): void
Facades\Form::make('newsletter')->save();
}

public function configFileProvider()
public static function configFileProvider()
{
return [
['api'],
Expand Down
4 changes: 2 additions & 2 deletions tests/Actions/DuplicateEntryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function it_authorizes(
$this->assertEquals($expectedToBeAuthorized, (new DuplicateEntry)->authorize($user, $item));
}

public function authorizationProvider()
public static function authorizationProvider()
{
return [
'no permission' => [
Expand Down Expand Up @@ -160,7 +160,7 @@ public function it_authorizes_in_bulk(
$this->assertEquals($expectedToBeAuthorized, (new DuplicateEntry)->authorizeBulk($user, $items));
}

public function bulkAuthorizationProvider()
public static function bulkAuthorizationProvider()
{
return [
'no permission' => [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@

use Statamic\Tags\Tags;

class Test extends Tags
class TestTags extends Tags
{
public static $lastValue = null;

public static $handle = 'test';

public function index()
{
self::$lastValue = $this->params->get('variable');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use Statamic\Tags\Tags;

class VarTest extends Tags
class VarTestTags extends Tags
{
protected static $handle = 'var_test';
public static $var = null;
Expand Down
2 changes: 1 addition & 1 deletion tests/Antlers/Runtime/AntlersQueryBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use Statamic\View\Antlers\Language\Runtime\GlobalRuntimeState;
use Statamic\View\Antlers\Language\Runtime\NodeProcessor;
use Tests\Antlers\Fixtures\Addon\Modifiers\IsBuilder;
use Tests\Antlers\Fixtures\Addon\Tags\VarTest;
use Tests\Antlers\Fixtures\Addon\Tags\VarTestTags as VarTest;
use Tests\Antlers\ParserTestCase;

class AntlersQueryBuilderTest extends ParserTestCase
Expand Down
2 changes: 1 addition & 1 deletion tests/Antlers/Runtime/ConditionLogicTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use Statamic\Taxonomies\TermCollection;
use Statamic\View\Antlers\Language\Exceptions\AntlersException;
use Statamic\View\Cascade;
use Tests\Antlers\Fixtures\Addon\Tags\VarTest;
use Tests\Antlers\Fixtures\Addon\Tags\VarTestTags as VarTest;
use Tests\Antlers\ParserTestCase;
use Tests\FakesViews;
use Tests\PreventSavingStacheItemsToDisk;
Expand Down
Loading

0 comments on commit d76a4b4

Please sign in to comment.