Squashed commit of the following:
commit 63912e4c20fc9b3d49670a0f547137d59aaa2ef4 Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Fri Oct 12 19:18:21 2018 +0100 Remove facebook syndication code
This commit is contained in:
parent
7c559860dc
commit
151072cd1b
10 changed files with 1 additions and 314 deletions
|
@ -1,38 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Unit\Jobs;
|
||||
|
||||
use Tests\TestCase;
|
||||
use GuzzleHttp\Client;
|
||||
use App\Models\Bookmark;
|
||||
use GuzzleHttp\HandlerStack;
|
||||
use GuzzleHttp\Psr7\Response;
|
||||
use GuzzleHttp\Handler\MockHandler;
|
||||
use App\Jobs\SyndicateBookmarkToFacebook;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
|
||||
class SyndicateBookmarkToFacebookJobTest extends TestCase
|
||||
{
|
||||
use DatabaseTransactions;
|
||||
|
||||
public function test_the_job()
|
||||
{
|
||||
$json = json_encode([
|
||||
'url' => 'https://facebook.com/123'
|
||||
]);
|
||||
$mock = new MockHandler([
|
||||
new Response(201, ['Content-Type' => 'application/json'], $json),
|
||||
]);
|
||||
$handler = HandlerStack::create($mock);
|
||||
$client = new Client(['handler' => $handler]);
|
||||
|
||||
$bookmark = Bookmark::find(1);
|
||||
$job = new SyndicateBookmarkToFacebook($bookmark);
|
||||
$job->handle($client);
|
||||
|
||||
$this->assertDatabaseHas('bookmarks', [
|
||||
'id' => 1,
|
||||
'syndicates' => '{"facebook": "https://facebook.com/123"}',
|
||||
]);
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Unit\Jobs;
|
||||
|
||||
use Tests\TestCase;
|
||||
use App\Models\Note;
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\HandlerStack;
|
||||
use GuzzleHttp\Psr7\Response;
|
||||
use GuzzleHttp\Handler\MockHandler;
|
||||
use App\Jobs\SyndicateNoteToFacebook;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
|
||||
class SyndicateNoteToFacebookJobTest extends TestCase
|
||||
{
|
||||
use DatabaseTransactions;
|
||||
|
||||
public function test_the_job()
|
||||
{
|
||||
$json = json_encode([
|
||||
'url' => 'https://facebook.com/123'
|
||||
]);
|
||||
$mock = new MockHandler([
|
||||
new Response(201, ['Content-Type' => 'application/json'], $json),
|
||||
]);
|
||||
$handler = HandlerStack::create($mock);
|
||||
$client = new Client(['handler' => $handler]);
|
||||
|
||||
$note = Note::find(1);
|
||||
$job = new SyndicateNoteToFacebook($note);
|
||||
$job->handle($client);
|
||||
|
||||
$this->assertDatabaseHas('notes', [
|
||||
'id' => 1,
|
||||
'facebook_url' => 'https://facebook.com/123',
|
||||
]);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue