PHP Classes

File: tests/Feature/Commands/ShowCommandTest.php

Recommend this page to a friend!
  Packages of Alberto Arena   Laravel Truss   tests/Feature/Commands/ShowCommandTest.php   Download  
File: tests/Feature/Commands/ShowCommandTest.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Laravel Truss
View a diagram of a Laravel application models
Author: By
Last change:
Date: 8 days ago
Size: 1,003 bytes
 

Contents

Class file image Download
<?php

declare(strict_types=1);

use
Illuminate\Support\Facades\Schema;

beforeEach(function () {
   
Schema::create('widgets', function ($table) {
       
$table->id();
       
$table->string('name');
    });
   
Schema::create('parts', function ($table) {
       
$table->id();
       
$table->foreignId('widget_id')->constrained();
    });
});

it('prints the schema as a table of tables', function () {
   
$this->artisan('truss:show')
        ->
assertSuccessful()
        ->
expectsOutputToContain('widgets')
        ->
expectsOutputToContain('parts')
        ->
expectsOutputToContain('Foreign keys');
});

it('points the reader at the visual dashboard command', function () {
   
$this->artisan('truss:show')
        ->
assertSuccessful()
        ->
expectsOutputToContain('truss:open');
});

it('shows a specific connection with --connection', function () {
   
$this->artisan('truss:show', ['--connection' => 'testing'])
        ->
assertSuccessful()
        ->
expectsOutputToContain('widgets');
});