Created
December 19, 2017 00:35
-
-
Save Zerquix18/618bf02f05458df913c05a9e9044c036 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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