f0ntana
3 months ago
332
3
Laravel

Testing Controller edit method

Posted 3 months ago by f0ntana

I want do this test, but my phpunit return a rysk, in my view i has a @extends and when i remove that no error more.

 public function testProjectContentStep1()
    {
        $url = route('dashboard.project.edit.content.step1', $this->project->id);
        $response = $this->get($url);
        $response->assertStatus(200);
        $response->assertViewIs('dashboard.project.edit.content.step-1');
        $response->assertViewHas(['progress', 'project']);
    }

Error:

1) Tests\Feature\Http\Controllers\Dashboard\Project\ContentControllerTest::testProjectContentStep1
Test code or tested code did not (only) close its own output buffers

OK, but incomplete, skipped, or risky tests!
Tests: 1, Assertions: 2, Risky: 1.

View start with:

@extends('user.project.edit')

@section('step')

View user.project.edit:

@extends('layout.app')

@php($description = null)
@php($keywords = null)
@php($title = null)

@section('meta_description', $description)
@section('meta_keywords', $keywords)
@section('meta_title', $title)

@section('meta_og_url', url('home'))
@section('meta_og_title', $title)
@section('meta_og_description', $description)
@section('meta_og_image', asset('images/og/og_app.jpg'))

@section('content')
    <section id="project-edit">
        @include('components.user.project.edit.sidebar')
        <div class="project-edit-steps">
            @yield('breadcrumb')
            @include('components.misc.alert')
            @yield('step', view('user.project.edit.progress'))
        </div>
    </section>
@endsection

Please sign in or create an account to participate in this conversation.