PHP code example of humans / laravel-setup-traits

1. Go to this page and download the library: Download humans/laravel-setup-traits library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

humans / laravel-setup-traits example snippets


class PostUpdateTest extends TestCase
{
    use ActingAsEdtior;
}

trait ActingAsEditor
{
    function setupActingAsEditor()
    {
        $this->editor = factory(User::class)->states('editor');
      
        $this->be($this->editor);
    }
}

use Humans\SetupTraits\SetupTraits;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;

abstract class TestCase extends BaseTestCase
{
    use SetupTraits;
}

use Illuminate\Support\Facades\Notification;

trait	WithoutNotifications
{
    function setupWithoutNotifications
    {
        Notification::fake();
    }
}

class SettingsUpdateTest extends TestCase
{
    use WithoutNotifications;
}