Flugg\Responder\Tests\Unit\ErrorResponseBuilderTest::setErrorMethodShouldAllowOverridingErrorMessage PHP Метод

setErrorMethodShouldAllowOverridingErrorMessage() публичный Метод

Test that the [setError] method allows passing a string as second argument instead of an array of parameters, which will override the error message and set it explicitly.
    public function setErrorMethodShouldAllowOverridingErrorMessage()
    {
        // Arrange...
        $this->mockTranslator('Testing error 1');
        $responseBuilder = $this->app->make('responder.error');
        // Act...
        $responseBuilder->setError('testing_error', 'Testing error 2');
        // Assert...
        $this->assertEquals(['success' => false, 'error' => ['code' => 'testing_error', 'message' => 'Testing error 2']], $responseBuilder->toArray());
    }