Francisco Morales
Francisco Morales
Comparte:

No pasan mis tests | Laravel API

Hola
Me encuentro haciendo el curso de API y no consigo hacer pasar los test. 
Este es el output al ejecutar mis tests.
Espero me puedan dar una pista de como solucionarlo. 
Gracias
PHPUnit\Framework\ExpectationFailedException]8;;file://C:\laragon\www\jsonapi\vendor\phpunit\phpunit\src\Framework\Exception\ExpectationFailedException.php#L24\^]8;;\ {#3007
  #comparisonFailure: null
  #serializableTrace: array:19 [
    0 => array:5 [
      "file" => "C:\laragon\www\jsonapi\vendor\phpunit\phpunit\src\Framework\Constraint\Constraint.php"
      "line" => 55
      "function" => "fail"
      "class" => "PHPUnit\Framework\Constraint\Constraint"
      "type" => "->"
    ]
    1 => array:5 [
      "file" => "C:\laragon\www\jsonapi\vendor\phpunit\phpunit\src\Framework\Assert.php"
      "line" => 2344
      "function" => "evaluate"
      "class" => "PHPUnit\Framework\Constraint\Constraint"
      "type" => "->"
    ]
    2 => array:5 [
      "file" => "C:\laragon\www\jsonapi\vendor\phpunit\phpunit\src\Framework\Assert.php"
      "line" => 1064
      "function" => "assertThat"
      "class" => "PHPUnit\Framework\Assert"
      "type" => "::"
    ]
    3 => array:5 [
      "file" => "C:\laragon\www\jsonapi\vendor\laravel\framework\src\Illuminate\Testing\AssertableJsonString.php"
      "line" => 144
      "function" => "assertTrue"
      "class" => "PHPUnit\Framework\Assert"
      "type" => "::"
    ]
    4 => array:5 [
      "file" => "C:\laragon\www\jsonapi\vendor\laravel\framework\src\Illuminate\Testing\TestResponse.php"
      "line" => 757
      "function" => "assertFragment"
      "class" => "Illuminate\Testing\AssertableJsonString"
      "type" => "->"
    ]
    5 => array:5 [
      "file" => "C:\laragon\www\jsonapi\tests\MakesJsonApiRequest.php"
      "line" => 43
      "function" => "assertJsonFragment"
      "class" => "Illuminate\Testing\TestResponse"
      "type" => "->"
    ]
    6 => array:5 [
      "file" => "C:\laragon\www\jsonapi\vendor\laravel\framework\src\Illuminate\Macroable\Traits\Macroable.php"
      "line" => 124
      "function" => "Tests\{closure}"
      "class" => "Illuminate\Testing\TestResponse"
      "type" => "->"
    ]
    7 => array:5 [
      "file" => "C:\laragon\www\jsonapi\vendor\laravel\framework\src\Illuminate\Testing\TestResponse.php"
      "line" => 1603
      "function" => "macroCall"
      "class" => "Illuminate\Testing\TestResponse"
      "type" => "->"
    ]
    8 => array:5 [
      "file" => "C:\laragon\www\jsonapi\tests\Feature\Articles\CreateArticleTest.php"
      "line" => 70
      "function" => "__call"
      "class" => "Illuminate\Testing\TestResponse"
      "type" => "->"
    ]
    9 => array:5 [
      "file" => "C:\laragon\www\jsonapi\vendor\phpunit\phpunit\src\Framework\TestCase.php"
      "line" => 1527
      "function" => "title_is_required"
      "class" => "Tests\Feature\Articles\CreateArticleTest"
      "type" => "->"
    ]
    10 => array:5 [
      "file" => "C:\laragon\www\jsonapi\vendor\phpunit\phpunit\src\Framework\TestCase.php"
      "line" => 1133
      "function" => "runTest"
      "class" => "PHPUnit\Framework\TestCase"
      "type" => "->"
    ]
    11 => array:5 [
      "file" => "C:\laragon\www\jsonapi\vendor\phpunit\phpunit\src\Framework\TestResult.php"
      "line" => 722
      "function" => "runBare"
      "class" => "PHPUnit\Framework\TestCase"
      "type" => "->"
    ]
    12 => array:5 [
      "file" => "C:\laragon\www\jsonapi\vendor\phpunit\phpunit\src\Framework\TestCase.php"
      "line" => 885
      "function" => "run"
      "class" => "PHPUnit\Framework\TestResult"
      "type" => "->"
    ]
    13 => array:5 [
      "file" => "C:\laragon\www\jsonapi\vendor\phpunit\phpunit\src\Framework\TestSuite.php"
      "line" => 678
      "function" => "run"
      "class" => "PHPUnit\Framework\TestCase"
      "type" => "->"
    ]
    14 => array:5 [
      "file" => "C:\laragon\www\jsonapi\vendor\phpunit\phpunit\src\Framework\TestSuite.php"
      "line" => 678
      "function" => "run"
      "class" => "PHPUnit\Framework\TestSuite"
      "type" => "->"
    ]
    15 => array:5 [
      "file" => "C:\laragon\www\jsonapi\vendor\phpunit\phpunit\src\TextUI\TestRunner.php"
      "line" => 670
      "function" => "run"
      "class" => "PHPUnit\Framework\TestSuite"
      "type" => "->"
    ]
    16 => array:5 [
      "file" => "C:\laragon\www\jsonapi\vendor\phpunit\phpunit\src\TextUI\Command.php"
      "line" => 143
      "function" => "run"
      "class" => "PHPUnit\TextUI\TestRunner"
      "type" => "->"
    ]
    17 => array:5 [
      "file" => "C:\laragon\www\jsonapi\vendor\phpunit\phpunit\src\TextUI\Command.php"
      "line" => 96
      "function" => "run"
      "class" => "PHPUnit\TextUI\Command"
      "type" => "->"
    ]
    18 => array:5 [
      "file" => "C:\laragon\www\jsonapi\vendor\phpunit\phpunit\phpunit"
      "line" => 92
      "function" => "main"
      "class" => "PHPUnit\TextUI\Command"
      "type" => "::"
    ]
  ]
  #message: """
    Unable to find JSON fragment: \r\n
    \r\n
    [{"source":{"pointer":"\/data\/attributes\/title"}}]\r\n
    \r\n
    within\r\n
    \r\n
    [{"data":{"attributes":{"content":"Contenido del art\u00edculo","slug":"nuevo-articulo","title":"Nuevo art\u00edculo"},"id":"1","links":{"self":"http:\/\/jsonapi.dev.com\/api\/v1\/articles\/1"},"type":"articles"}}].\n
    Failed asserting that false is true.
    """
  #code: 0
  #file: "]8;;file://C:\laragon\www\jsonapi\vendor\phpunit\phpunit\src\Framework\Constraint\Constraint.php#L121\C:\laragon\www\jsonapi\vendor\phpunit\phpunit\src\Framework\Constraint\Constraint.php]8;;\"
  #line: 121
  trace: {
    ]8;;file://C:\laragon\www\jsonapi\vendor\phpunit\phpunit\src\Framework\Constraint\Constraint.php#L121\C:\laragon\www\jsonapi\vendor\phpunit\phpunit\src\Framework\Constraint\Constraint.php:121]8;;\ { …}
    ]8;;file://C:\laragon\www\jsonapi\vendor\phpunit\phpunit\src\Framework\Constraint\Constraint.php#L55\C:\laragon\www\jsonapi\vendor\phpunit\phpunit\src\Framework\Constraint\Constraint.php:55]8;;\ { …}
    ]8;;file://C:\laragon\www\jsonapi\vendor\phpunit\phpunit\src\Framework\Assert.php#L2344\C:\laragon\www\jsonapi\vendor\phpunit\phpunit\src\Framework\Assert.php:2344]8;;\ { …}
    ]8;;file://C:\laragon\www\jsonapi\vendor\phpunit\phpunit\src\Framework\Assert.php#L1064\C:\laragon\www\jsonapi\vendor\phpunit\phpunit\src\Framework\Assert.php:1064]8;;\ { …}
    ]8;;file://C:\laragon\www\jsonapi\vendor\laravel\framework\src\Illuminate\Testing\AssertableJsonString.php#L144\C:\laragon\www\jsonapi\vendor\laravel\framework\src\Illuminate\Testing\AssertableJsonString.php:144]8;;\ { …}
    ]8;;file://C:\laragon\www\jsonapi\vendor\laravel\framework\src\Illuminate\Testing\TestResponse.php#L757\C:\laragon\www\jsonapi\vendor\laravel\framework\src\Illuminate\Testing\TestResponse.php:757]8;;\ { …}
    ]8;;file://C:\laragon\www\jsonapi\tests\MakesJsonApiRequest.php#L43\C:\laragon\www\jsonapi\tests\MakesJsonApiRequest.php:43]8;;\ {
      Illuminate\Testing\TestResponse->Tests\{closure}]8;;file://C:\laragon\www\jsonapi\tests\MakesJsonApiRequest.php#L43\^]8;;\
      › $this->assertJsonFragment([
      › ]8;;file://C:\laragon\www\jsonapi\tests\MakesJsonApiRequest.php#L43\    'source' => ['pointer' => '/data/attributes/' . $attribute]]8;;\
      › ]);
      arguments: {
        $data: array:1 [ …1]
      }
    }
    ]8;;file://C:\laragon\www\jsonapi\vendor\laravel\framework\src\Illuminate\Macroable\Traits\Macroable.php#L124\C:\laragon\www\jsonapi\vendor\laravel\framework\src\Illuminate\Macroable\Traits\Macroable.php:124]8;;\ { …}
    ]8;;file://C:\laragon\www\jsonapi\vendor\laravel\framework\src\Illuminate\Testing\TestResponse.php#L1603\C:\laragon\www\jsonapi\vendor\laravel\framework\src\Illuminate\Testing\TestResponse.php:1603]8;;\ { …}
    ]8;;file://C:\laragon\www\jsonapi\tests\Feature\Articles\CreateArticleTest.php#L70\C:\laragon\www\jsonapi\tests\Feature\Articles\CreateArticleTest.php:70]8;;\ { …}
    ]8;;file://C:\laragon\www\jsonapi\vendor\phpunit\phpunit\src\Framework\TestCase.php#L1527\C:\laragon\www\jsonapi\vendor\phpunit\phpunit\src\Framework\TestCase.php:1527]8;;\ { …}
    ]8;;file://C:\laragon\www\jsonapi\vendor\phpunit\phpunit\src\Framework\TestCase.php#L1133\C:\laragon\www\jsonapi\vendor\phpunit\phpunit\src\Framework\TestCase.php:1133]8;;\ { …}
    ]8;;file://C:\laragon\www\jsonapi\vendor\phpunit\phpunit\src\Framework\TestResult.php#L722\C:\laragon\www\jsonapi\vendor\phpunit\phpunit\src\Framework\TestResult.php:722]8;;\ { …}
    ]8;;file://C:\laragon\www\jsonapi\vendor\phpunit\phpunit\src\Framework\TestCase.php#L885\C:\laragon\www\jsonapi\vendor\phpunit\phpunit\src\Framework\TestCase.php:885]8;;\ { …}
    ]8;;file://C:\laragon\www\jsonapi\vendor\phpunit\phpunit\src\Framework\TestSuite.php#L678\C:\laragon\www\jsonapi\vendor\phpunit\phpunit\src\Framework\TestSuite.php:678]8;;\ { …}
    ]8;;file://C:\laragon\www\jsonapi\vendor\phpunit\phpunit\src\Framework\TestSuite.php#L678\C:\laragon\www\jsonapi\vendor\phpunit\phpunit\src\Framework\TestSuite.php:678]8;;\ { …}
    ]8;;file://C:\laragon\www\jsonapi\vendor\phpunit\phpunit\src\TextUI\TestRunner.php#L670\C:\laragon\www\jsonapi\vendor\phpunit\phpunit\src\TextUI\TestRunner.php:670]8;;\ { …}
    ]8;;file://C:\laragon\www\jsonapi\vendor\phpunit\phpunit\src\TextUI\Command.php#L143\C:\laragon\www\jsonapi\vendor\phpunit\phpunit\src\TextUI\Command.php:143]8;;\ { …}
    ]8;;file://C:\laragon\www\jsonapi\vendor\phpunit\phpunit\src\TextUI\Command.php#L96\C:\laragon\www\jsonapi\vendor\phpunit\phpunit\src\TextUI\Command.php:96]8;;\ { …}
    ]8;;file://C:\laragon\www\jsonapi\vendor\phpunit\phpunit\phpunit#L92\C:\laragon\www\jsonapi\vendor\phpunit\phpunit\phpunit:92]8;;\ { …}
  }
}
Process finished with exit code 1