Fix issues with travis and setting up an indieweb user we don’t need anymore
This commit is contained in:
parent
08cdfe1e44
commit
2151d5658b
3 changed files with 0 additions and 101 deletions
|
@ -54,7 +54,6 @@ before_script:
|
|||
- php artisan key:generate
|
||||
- php artisan migrate
|
||||
- php artisan db:seed
|
||||
- php artisan token:generate
|
||||
- google-chrome-stable --headless --disable-gpu --remote-debugging-port=9515 http://localhost:8000 &
|
||||
|
||||
script:
|
||||
|
|
|
@ -1,61 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\IndieWebUser;
|
||||
use App\Services\TokenService;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class GenerateToken extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'token:generate';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Generate a token that can be used for testing purposes';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* The token service class.
|
||||
*
|
||||
* @var TokenService
|
||||
*/
|
||||
protected $tokenService;
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle(TokenService $tokenService)
|
||||
{
|
||||
$data = [
|
||||
'me' => config('app.url'),
|
||||
'client_id' => route('micropub-client'),
|
||||
'scope' => 'create update',
|
||||
];
|
||||
$token = $tokenService->getNewToken($data);
|
||||
$user = IndieWebUser::where('me', config('app.url'))->first();
|
||||
$user->token = $token;
|
||||
$user->save();
|
||||
|
||||
$this->info('Set token');
|
||||
}
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Browser;
|
||||
|
||||
use Tests\DuskTestCase;
|
||||
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
||||
|
||||
class MicropubClientTest extends DuskTestCase
|
||||
{
|
||||
/**
|
||||
* Test the client is shown for an unauthorised request.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_client_page_see_authenticated()
|
||||
{
|
||||
$this->browse(function ($browser) {
|
||||
$browser->visit(route('micropub-client'))
|
||||
->assertSee('You are authenticated as');
|
||||
});
|
||||
}
|
||||
|
||||
public function test_client_page_creates_new_note()
|
||||
{
|
||||
\Artisan::call('token:generate');
|
||||
$faker = \Faker\Factory::create();
|
||||
$note = 'Fake note from #LaravelDusk: ' . $faker->text;
|
||||
$this->browse(function ($browser) use ($note) {
|
||||
$response = $browser->visit(route('micropub-client'))
|
||||
->assertSeeLink('log out')
|
||||
->type('content', $note);
|
||||
$response->element('form')->submit();
|
||||
});
|
||||
sleep(2);
|
||||
$this->assertDatabaseHas('notes', ['note' => $note]);
|
||||
$newNote = \App\Note::where('note', $note)->first();
|
||||
$newNote->forceDelete();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue