Skip to content

Commit

Permalink
environment-setup -> DefineEnvironment
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanmitchell committed Jun 21, 2024
1 parent 6f0d0f6 commit 02d2732
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 29 deletions.
5 changes: 2 additions & 3 deletions tests/API/CacherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Illuminate\Http\Request;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Cache;
use Orchestra\Testbench\Attributes\DefineEnvironment;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Test;
use Statamic\API\AbstractCacher;
Expand Down Expand Up @@ -115,9 +116,7 @@ public static function bypassCacheProvider()
}

#[Test]
/**
* @environment-setup setCustomExpiry
*/
#[DefineEnvironment('setCustomExpiry')]
public function it_caches_endpoint_using_configured_expiry()
{
$this->makeEntry('apple')->save();
Expand Down
15 changes: 5 additions & 10 deletions tests/Feature/GraphQL/CustomMiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Tests\Feature\GraphQL;

use Orchestra\Testbench\Attributes\DefineEnvironment;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\Test;
use Statamic\Facades\GraphQL;
Expand All @@ -25,11 +26,8 @@ public function custom_middleware_does_not_yet_exist()
$this->assertEquals(0, app('request-count'));
}

/**
* @test
*
* @environment-setup addCustomMiddlewareWithMethod
**/
#[Test]
#[DefineEnvironment('addCustomMiddlewareWithMethod')]
public function a_custom_middleware_can_be_added_to_the_default_schema()
{
$this->post('/graphql', ['query' => '{ping}']);
Expand All @@ -42,11 +40,8 @@ protected function addCustomMiddlewareWithMethod($app)
GraphQL::addMiddleware(CountRequests::class);
}

/**
* @test
*
* @environment-setup addCustomMiddlewareThroughConfig
**/
#[Test]
#[DefineEnvironment('addCustomMiddlewareWithMethod')]
public function a_custom_middleware_can_be_added_to_the_default_schema_through_config()
{
$this->post('/graphql', ['query' => '{ping}']);
Expand Down
10 changes: 4 additions & 6 deletions tests/Feature/GraphQL/CustomQueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Tests\Feature\GraphQL;

use GraphQL\Type\Definition\Type;
use Orchestra\Testbench\Attributes\DefineEnvironment;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\Test;
use Statamic\Facades\GraphQL;
Expand All @@ -25,7 +26,7 @@ public function custom_query_does_not_yet_exist()
/**
* @test
*
* @environment-setup addCustomQueryWithMethod
* ronment-setup addCustomQueryWithMethod
**/
public function a_custom_query_can_be_added_to_the_default_schema()
{
Expand All @@ -40,11 +41,8 @@ protected function addCustomQueryWithMethod($app)
GraphQL::addQuery(FooQuery::class);
}

/**
* @test
*
* @environment-setup addCustomQueryThroughConfig
**/
#[Test]
#[DefineEnvironment('addCustomQueryThroughConfig')]
public function a_custom_query_can_be_added_to_the_default_schema_through_config()
{
$this
Expand Down
8 changes: 3 additions & 5 deletions tests/Listeners/UpdateAssetReferencesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Storage;
use Orchestra\Testbench\Attributes\DefineEnvironment;
use PHPUnit\Framework\Attributes\Test;
use Statamic\Assets\AssetFolder;
use Statamic\Facades;
Expand Down Expand Up @@ -378,11 +379,8 @@ public function it_nullifies_references_when_deleting_an_asset()
$this->assertFalse($entry->fresh()->has('featured'));
}

/**
* @test
*
* @environment-setup disableUpdateReferences
**/
#[Test]
#[DefineEnvironment('disableUpdateReferences')]
public function it_can_be_disabled()
{
$collection = tap(Facades\Collection::make('articles'))->save();
Expand Down
8 changes: 3 additions & 5 deletions tests/Listeners/UpdateTermReferencesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Tests\Listeners;

use Orchestra\Testbench\Attributes\DefineEnvironment;
use PHPUnit\Framework\Attributes\Test;
use Statamic\Facades;
use Statamic\Support\Arr;
Expand Down Expand Up @@ -368,11 +369,8 @@ public function it_nullifies_references_when_deleting_a_scoped_term()
$this->assertFalse($entry->fresh()->has('favourites'));
}

/**
* @test
*
* @environment-setup disableUpdateReferences
**/
#[Test]
#[DefineEnvironment('disableUpdateReferences')]
public function it_can_be_disabled()
{
$collection = tap(Facades\Collection::make('articles'))->save();
Expand Down

0 comments on commit 02d2732

Please sign in to comment.