Skip to main content

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

Read more here

tighten/novapackages

336 stars
1 code files
View tighten/novapackages on GitHub

tests/Feature/CollaboratorCreateTest.php

Open in GitHub
use App\Collaborator;
use App\Http\Remotes\GitHub;
use App\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Mockery as m;
use Tests\TestCase;
 
class CollaboratorCreateTest extends TestCase
{
use RefreshDatabase;
 
/** @test */
public function the_url_field_is_optional()
{
$this->withoutEvents();
 
$github = m::mock(GitHub::class)->shouldIgnoreMissing();
$this->app->instance(GitHub::class, $github);
 
$user = User::factory()->create();
$userData = [
'name' => 'John Smith',
'url' => '',
'description' => 'This is a description for John',
'github_username' => 'johnsmith',
];
 
$response = $this->actingAs($user)->post(route('app.collaborators.store'), $userData);
 
$response->assertSessionHasNoErrors();
$this->assertCount(1, Collaborator::all());
 
tap(Collaborator::first(), function ($collaborator) use ($userData) {
$this->assertEquals($userData['name'], $collaborator->name);
$this->assertEquals($userData['url'], $collaborator->url);
$this->assertEquals($userData['description'], $collaborator->description);
$this->assertEquals($userData['github_username'], $collaborator->github_username);
});
}
}

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.