Have webmentions sent automatically

This commit is contained in:
Jonny Barnes 2016-06-23 14:27:00 +01:00
parent 44060da577
commit e31364e787
7 changed files with 49 additions and 11 deletions

View file

@ -38,7 +38,7 @@ class MicropubTest extends TestCase
public function testMicropubRequestWithValidToken()
{
$this->call('GET', $this->appurl . '/api/post', [], [], [], ['HTTP_Authorization' => 'Bearer ' . $this->getToken()]);
$this->see('me=https%3A%2F%2Fjbl5.dev');
$this->see('me=https%3A%2F%2Fjonnybarnes.localhost');
}
public function testMicropubRequestForSyndication()
@ -79,8 +79,6 @@ class MicropubTest extends TestCase
public function testMicropubRequestCreateNewPlace()
{
$faker = \Faker\Factory::create();
$note = $faker->text;
$this->call(
'POST',
$this->appurl . '/api/post',
@ -101,7 +99,7 @@ class MicropubTest extends TestCase
$signer = new Sha256();
$token = (new Builder())
->set('client_id', 'https://quill.p3k.io')
->set('me', 'https://jbl5.dev')
->set('me', 'https://jonnybarnes.localhost')
->set('scope', 'post')
->set('issued_at', time())
->sign($signer, env('APP_KEY'))

33
tests/NotesAdminTest.php Normal file
View file

@ -0,0 +1,33 @@
<?php
namespace App\Tests;
use TestCase;
use Illuminate\Foundation\Testing\WithoutMiddleware;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;
class NotesAdminTest extends TestCase
{
use DatabaseTransactions;
protected $appurl;
protected $notesAdminController;
public function setUp()
{
parent::setUp();
$this->appurl = config('app.url');
$this->notesAdminController = new \App\Http\Controllers\NotesAdminController();
}
public function testCreatedNoteDispatchesSendWebmentionsJob()
{
$this->expectsJobs(\App\Jobs\SendWebMentions::class);
$this->withSession(['loggedin' => true])
->visit($this->appurl . '/admin/note/new')
->type('Mentioning', 'content')
->press('Submit');
}
}