feat: ship creator journey v2 and profile updates
This commit is contained in:
@@ -7,6 +7,8 @@ use App\Models\Category;
|
||||
use App\Models\ContentType;
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Pagination\LengthAwarePaginator;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Tests\TestCase;
|
||||
|
||||
class BrowseApiTest extends TestCase
|
||||
@@ -199,4 +201,54 @@ class BrowseApiTest extends TestCase
|
||||
$this->assertStringContainsString('data-gallery-type="browse"', $html);
|
||||
$this->assertStringContainsString('Forest Light', $html);
|
||||
}
|
||||
|
||||
public function test_web_browse_filters_out_artworks_that_are_no_longer_publicly_browsable(): void
|
||||
{
|
||||
$user = User::factory()->create(['name' => 'Visibility Author']);
|
||||
$contentType = ContentType::create([
|
||||
'name' => 'Skins',
|
||||
'slug' => 'skins',
|
||||
'description' => 'Skins content type',
|
||||
]);
|
||||
|
||||
$category = Category::create([
|
||||
'content_type_id' => $contentType->id,
|
||||
'name' => 'Minimal',
|
||||
'slug' => 'minimal',
|
||||
'description' => 'Minimal skins',
|
||||
'is_active' => true,
|
||||
'sort_order' => 1,
|
||||
]);
|
||||
|
||||
$visible = Artwork::factory()->for($user)->create([
|
||||
'title' => 'Visible Explore Item',
|
||||
'slug' => 'visible-explore-item',
|
||||
'published_at' => now()->subHour(),
|
||||
'is_public' => true,
|
||||
'is_approved' => true,
|
||||
]);
|
||||
$visible->categories()->attach($category->id);
|
||||
|
||||
$hidden = Artwork::factory()->for($user)->create([
|
||||
'title' => 'Hidden Explore Item',
|
||||
'slug' => 'hidden-explore-item',
|
||||
'published_at' => now()->subHour(),
|
||||
'is_public' => false,
|
||||
'is_approved' => false,
|
||||
]);
|
||||
$hidden->categories()->attach($category->id);
|
||||
|
||||
Cache::forever('explore.cache.version', 1);
|
||||
Cache::put(
|
||||
'explore.all.v1.trending.1',
|
||||
new LengthAwarePaginator(collect([$hidden, $visible]), 2, 24, 1),
|
||||
300,
|
||||
);
|
||||
|
||||
$response = $this->get('/explore');
|
||||
|
||||
$response->assertOk()
|
||||
->assertSee('Visible Explore Item')
|
||||
->assertDontSee('Hidden Explore Item');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user