Skip to content

Instantly share code, notes, and snippets.

@Zerquix18
Created December 19, 2017 00:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Zerquix18/618bf02f05458df913c05a9e9044c036 to your computer and use it in GitHub Desktop.
Save Zerquix18/618bf02f05458df913c05a9e9044c036 to your computer and use it in GitHub Desktop.
<?php
/**
* Tests for the MemeFinder
* Includes HTTP and Browser tests
*/
namespace Tests\Feature;
use Tests\TestCase;
use Illuminate\Foundation\Testing\WithoutMiddleware;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use App\User;
class MemeFinderTest extends TestCase
{
/**
* Tests the memes/get endpoint
*/
public function testGetMemes()
{
$user = factory(User::class)->create();
$response = $this->actingAs($user)
->json('GET', 'ajax/memes/get/');
$response->assertStatus(200);
$response->assertExactJson(['success' => true]);
}
/**
* Tests the option to add sources
*/
public function testAddSources()
{
$user = factory(User::class)->create();
// one source per site
$sources = '';
$sources .= "https://www.reddit.com/r/videos/\n";
$sources .= "https://twitter.com/itmeirl\n";
$sources .= "https://facebook.com/8shit\n";
// IG not included as it's not working rn.
$response = $this->actingAs($user)
->json(
'POST',
'ajax/sources/post',
['sources' => $sources]
);
$response->assertStatus(200);
$response->assertExactJson(['success' => true]);
}
/**
* Tests the option to fetch memes
* memes/fetch
*/
public function testFetchMemes()
{
$user = factory(User::class)->create();
$response = $this->actingAs($user)
->json('POST', 'ajax/memes/fetch');
$response->assertStatus(200);
$response->assertExactJson(['success' => true]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment