Skip to main content

Black Friday 2025! Only until December 1st: coupon FRIDAY25 for 40% off Yearly/Lifetime membership!

Read more here

tighten/laravelversions

98 stars
1 code files
View tighten/laravelversions on GitHub

tests/Feature/ApiListVersionsTest.php

Open in GitHub
use App\Models\LaravelVersion;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
 
class ApiListVersionsTest extends TestCase
{
use RefreshDatabase;
 
/** @test */
public function it_loads()
{
$response = $this->get(route('api.versions.index'));
 
$response->assertStatus(200);
}
 
/** @test */
public function it_lists_valid_versions()
{
$version = LaravelVersion::factory()->create([
'major' => 6,
]);
$response = $this->get(route('api.versions.index'));
$this->assertCount(1, $response->json()['data']);
}
 
/** @test */
public function it_doesnt_list_future_versions()
{
LaravelVersion::factory()->create([
'released_at' => now()->addDays(20),
]);
 
$response = $this->get(route('api.versions.index'));
$this->assertEmpty($response->json()['data']);
}
 
/** @test */
public function entries_arent_given_specific_version_key()
{
LaravelVersion::factory()->create();
$response = $this->get(route('api.versions.index'));
$entry = $response->json()['data'][0];
 
$this->assertFalse(array_key_exists('specific_version', $entry));
}
}

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.