Lestah
4 months ago
1486
5
Testing

Array to string conversion Feature Test

Posted 4 months ago by Lestah

/**
     * Add. test pass
     *
     * @test
     * @group  feature
     * @group  feature:setting
     * @group  settings.index
     * @return void
     */
    public function a_user_can_save_preferred_date_format()
    {
        // Arrangements
        $this->withoutExceptionHandling();
        $this->actingAs($user = $this->asNonSuperAdmin(['settings.store', 'settings.preferences']));
        $this->withPermissionsPolicy();

        // Actions
        $attributes = [ 'format:date' => [
            'key' => 'format:date',
            'value' => settings('format:date')
        ]];

        $response = $this->post(
            route('settings.store'), $attributes,
            ['HTTP_REFERER' => route('settings.preferences')]
        );

        // Assertions
        $response->assertRedirect(route('settings.preferences'));
        $this->assertDatabaseHas($this->service->getTable(), $attributes);
    }

I'm not sure on this line


  $response = $this->post(
            route('settings.store'), $attributes,
            ['HTTP_REFERER' => route('settings.preferences')]
        );

I got an error that says ErrorException: Array to string conversion what could be wrong? can someone have an idea thanks

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