1. Run successfully in Altair GraphQL Client. as shown in Figure 1

mutation CreateThemeAsset {
onlineStoreThemeAssetCreate(
input: { themeId: "vogue", content: "string", key: "js/20220307.4.js" }
) {
themeAsset {
themeId
key
content
}
}
}
{
"data": {
"onlineStoreThemeAssetCreate": {
"themeAsset": {
"themeId": "vogue",
"key": "js/20220307.4.js",
"content": "string"
}
}
}
}
2. Edit the test file, /modules/themestore/tests/functional/graphql/MutationThemeAssetGraphQLapTest.php.
<?php
namespace Modules\ThemeStore\Tests\Functional\GraphQl;
use Nuwave\Lighthouse\Testing\MakesGraphQLRequests;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
use Nuwave\Lighthouse\Testing\ClearsSchemaCache;
use Sentry\Util\JSON;
use Tests\CreatesApplication;
class MutationThemeAssetGraphQlApiTest extends BaseTestCase
{
use CreatesApplication,
ClearsSchemaCache,
MakesGraphQLRequests;
public function testCreateThemeAsset(): void
{
$input = [
'themeId' => 'vogue',
'content' => 'string',
'key' => 'js/20220307.8.js',
];
$response = $this->graphQL('
mutation CreateThemeAsset($input: ThemeAssetCreateInput!) {
onlineStoreThemeAssetCreate(input: $input) {
themeAsset {
themeId
key
content
}
}
}
', [
'input' => json_encode($input)
]);
$response->assertJson(
[
'data' => [
'onlineStoreThemeAssetCreate' => [
'themeAsset' => $input
],
],
]
);
}
protected function setUp(): void
{
parent::setUp();
$this->bootClearsSchemaCache();
}
}
3. Run the test case and report an error: Expected Type ThemeAssetCreateInput to be an object. as shown in Figure 2

PS E:\wwwroot\object> ./vendor/bin/phpunit --process-isolation .\Modules\ThemeStore\Tests\Functional\GraphQl\MutationThemeAssetGraphQlApiTest.php
PHPUnit 7.5.20 by Sebastian Bergmann and contributors.
F 1 / 1 (100%)
Time: 2.89 seconds, Memory: 16.00 MB
There was 1 failure:
1) Modules\ThemeStore\Tests\Functional\GraphQl\MutationThemeAssetGraphQlApiTest::testCreateThemeAsset
Unable to find JSON:
[{
"data": {
"onlineStoreThemeAssetCreate": {
"themeAsset": {
"themeId": "vogue",
"content": "string",
"key": "js/20220307.8.js"
}
}
}
}]
within response JSON:
[{
"errors": [
{
"message": "Variable \"$input\" got invalid value \"{\"themeId\":\"vogue\",\"content\":\"string\",\"key\":\"js\\/20220307.8.js\"}\"; Expected type ThemeAssetCreateInput to be an object.",
"extensions": {
"category": "graphql"
},
"locations": [
{
"line": 2,
"column": 39
}
]
}
]
}].
Failed asserting that an array has the subset Array &0 (
'data' => Array &1 (
'onlineStoreThemeAssetCreate' => Array &2 (
'themeAsset' => Array &3 (
'themeId' => 'vogue'
'content' => 'string'
'key' => 'js/20220307.8.js'
)
)
)
).
--- Expected
+++ Actual
@@ @@
),
),
),
- 'data' =>
- array (
- 'onlineStoreThemeAssetCreate' =>
- array (
- 'themeAsset' =>
- array (
- 'themeId' => 'vogue',
- 'content' => 'string',
- 'key' => 'js/20220307.8.js',
- ),
- ),
- ),
)
E:\wwwroot\object\vendor\laravel\framework\src\Illuminate\Foundation\Testing\Assert.php:108
E:\wwwroot\object\vendor\laravel\framework\src\Illuminate\Foundation\Testing\TestResponse.php:479
E:\wwwroot\object\Modules\ThemeStore\Tests\Functional\GraphQl\MutationThemeAssetGraphQlApiTest.php:56
FAILURES!
Tests: 1, Assertions: 1, Failures: 1.
PS E:\wwwroot\object>
4. Re-edit the test file
<?php
namespace Modules\ThemeStore\Tests\Functional\GraphQl;
use Nuwave\Lighthouse\Testing\MakesGraphQLRequests;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
use Nuwave\Lighthouse\Testing\ClearsSchemaCache;
use Sentry\Util\JSON;
use Tests\CreatesApplication;
class MutationThemeAssetGraphQlApiTest extends BaseTestCase
{
use CreatesApplication,
ClearsSchemaCache,
MakesGraphQLRequests;
public function testCreateThemeAsset(): void
{
$input = [
'themeId' => 'vogue',
'content' => 'string',
'key' => 'js/20220307.9.js',
];
$response = $this->graphQL('
mutation CreateThemeAsset($input: ThemeAssetCreateInput!) {
onlineStoreThemeAssetCreate(input: $input) {
themeAsset {
themeId
key
content
}
}
}
', [
'input' => json_decode(json_encode($input))
]);
$response->assertJson(
[
'data' => [
'onlineStoreThemeAssetCreate' => [
'themeAsset' => $input
],
],
]
);
}
protected function setUp(): void
{
parent::setUp();
$this->bootClearsSchemaCache();
}
}
5. Run the test again and the test passes.
PS E:\wwwroot\object> ./vendor/bin/phpunit --process-isolation .\Modules\ThemeStore\Tests\Functional\GraphQl\MutationThemeAssetGraphQlApiTest.php
PHPUnit 7.5.20 by Sebastian Bergmann and contributors.
. 1 / 1 (100%)
Time: 2.61 seconds, Memory: 16.00 MB
OK (1 test, 1 assertion)
6. Run the test again, the test fails. The reason is that the same request parameter does not allow duplication, otherwise the verification fails, and the test fails to assertion.
PS E:\wwwroot\object> ./vendor/bin/phpunit --process-isolation .\Modules\ThemeStore\Tests\Functional\GraphQl\MutationThemeAssetGraphQlApiTest.php
PHPUnit 7.5.20 by Sebastian Bergmann and contributors.
F 1 / 1 (100%)
Time: 2.77 seconds, Memory: 18.00 MB
There was 1 failure:
1) Modules\ThemeStore\Tests\Functional\GraphQl\MutationThemeAssetGraphQlApiTest::testCreateThemeAsset
Unable to find JSON:
[{
"data": {
"onlineStoreThemeAssetCreate": {
"themeAsset": {
"themeId": "vogue",
"content": "string",
"key": "js/20220307.9.js"
}
}
}
}]
within response JSON:
[{
"errors": [
{
"message": "Validation failed for the field [onlineStoreThemeAssetCreate].",
"extensions": {
"validation": {
"input.key": [
"The input.key has already been taken"
]
},
"category": "validation"
},
"locations": [
{
"line": 3,
"column": 17
}
],
"path": [
"onlineStoreThemeAssetCreate"
],
"trace": [
{
"file": "E:\\wwwroot\\object\\vendor\\nuwave\\lighthouse\\src\\Schema\\Directives\\ArgTraversalDirective.php",
"line": 29,
"call": "Nuwave\\Lighthouse\\Validation\\ValidateDirective::Nuwave\\Lighthouse\\Validation\\{closure}(null, array(1), instance of Nuwave\\Lighthouse\\Schema\\Context, instance of GraphQL\\Type\\Definition\\ResolveInfo)"
},
{
"file": "E:\\wwwroot\\object\\vendor\\nuwave\\lighthouse\\src\\Schema\\Directives\\TrimDirective.php",
"line": 56,
"call": "Nuwave\\Lighthouse\\Schema\\Directives\\ArgTraversalDirective::Nuwave\\Lighthouse\\Schema\\Directives\\{closure}(null, array(1), instance of Nuwave\\Lighthouse\\Schema\\Context, instance of GraphQL\\Type\\Definition\\ResolveInfo)"
},
{
"file": "E:\\wwwroot\\object\\vendor\\nuwave\\lighthouse\\src\\Schema\\Factories\\FieldFactory.php",
"line": 99,
"call": "Nuwave\\Lighthouse\\Schema\\Directives\\TrimDirective::Nuwave\\Lighthouse\\Schema\\Directives\\{closure}(null, array(1), instance of Nuwave\\Lighthouse\\Schema\\Context, instance of GraphQL\\Type\\Definition\\ResolveInfo)"
},
{
"file": "E:\\wwwroot\\object\\vendor\\webonyx\\graphql-php\\src\\Executor\\ReferenceExecutor.php",
"line": 623,
"call": "Nuwave\\Lighthouse\\Schema\\Factories\\FieldFactory::Nuwave\\Lighthouse\\Schema\\Factories\\{closure}(null, array(1), instance of Nuwave\\Lighthouse\\Schema\\Context, instance of GraphQL\\Type\\Definition\\ResolveInfo)"
},
{
"file": "E:\\wwwroot\\object\\vendor\\webonyx\\graphql-php\\src\\Executor\\ReferenceExecutor.php",
"line": 550,
"call": "GraphQL\\Executor\\ReferenceExecutor::resolveFieldValueOrError(instance of GraphQL\\Type\\Definition\\FieldDefinition, instance of GraphQL\\Language\\AST\\FieldNode, instance of Closure, null, instance of GraphQL\\Type\\Definition\\ResolveInfo)"
},
{
"file": "E:\\wwwroot\\object\\vendor\\webonyx\\graphql-php\\src\\Executor\\ReferenceExecutor.php",
"line": 474,
"call": "GraphQL\\Executor\\ReferenceExecutor::resolveField(GraphQLType: Mutation, null, instance of ArrayObject(1), array(1))"
},
{
"file": "E:\\wwwroot\\object\\vendor\\webonyx\\graphql-php\\src\\Executor\\ReferenceExecutor.php",
"line": 857,
"call": "GraphQL\\Executor\\ReferenceExecutor::GraphQL\\Executor\\{closure}(array(0), 'onlineStoreThemeAssetCreate')"
},
{
"call": "GraphQL\\Executor\\ReferenceExecutor::GraphQL\\Executor\\{closure}(array(0), 'onlineStoreThemeAssetCreate')"
},
{
"file": "E:\\wwwroot\\object\\vendor\\webonyx\\graphql-php\\src\\Executor\\ReferenceExecutor.php",
"line": 859,
"function": "array_reduce(array(1), instance of Closure, array(0))"
},
{
"file": "E:\\wwwroot\\object\\vendor\\webonyx\\graphql-php\\src\\Executor\\ReferenceExecutor.php",
"line": 490,
"call": "GraphQL\\Executor\\ReferenceExecutor::promiseReduce(array(1), instance of Closure, array(0))"
},
{
"file": "E:\\wwwroot\\object\\vendor\\webonyx\\graphql-php\\src\\Executor\\ReferenceExecutor.php",
"line": 263,
"call": "GraphQL\\Executor\\ReferenceExecutor::executeFieldsSerially(GraphQLType: Mutation, null, array(0), instance of ArrayObject(1))"
},
{
"file": "E:\\wwwroot\\object\\vendor\\webonyx\\graphql-php\\src\\Executor\\ReferenceExecutor.php",
"line": 215,
"call": "GraphQL\\Executor\\ReferenceExecutor::executeOperation(instance of GraphQL\\Language\\AST\\OperationDefinitionNode, null)"
},
{
"file": "E:\\wwwroot\\object\\vendor\\webonyx\\graphql-php\\src\\Executor\\Executor.php",
"line": 156,
"call": "GraphQL\\Executor\\ReferenceExecutor::doExecute()"
},
{
"file": "E:\\wwwroot\\object\\vendor\\webonyx\\graphql-php\\src\\GraphQL.php",
"line": 162,
"call": "GraphQL\\Executor\\Executor::promiseToExecute(instance of GraphQL\\Executor\\Promise\\Adapter\\SyncPromiseAdapter, instance of GraphQL\\Type\\Schema, instance of GraphQL\\Language\\AST\\DocumentNode, null, instance of Nuwave\\Lighthouse\\Schema\\Context, array(1), null, null)"
},
{
"file": "E:\\wwwroot\\object\\vendor\\webonyx\\graphql-php\\src\\GraphQL.php",
"line": 94,
"call": "GraphQL\\GraphQL::promiseToExecute(instance of GraphQL\\Executor\\Promise\\Adapter\\SyncPromiseAdapter, instance of GraphQL\\Type\\Schema, instance of GraphQL\\Language\\AST\\DocumentNode, null, instance of Nuwave\\Lighthouse\\Schema\\Context, array(1), null, null, array(29))"
},
{
"file": "E:\\wwwroot\\object\\vendor\\nuwave\\lighthouse\\src\\GraphQL.php",
"line": 268,
"call": "GraphQL\\GraphQL::executeQuery(instance of GraphQL\\Type\\Schema, instance of GraphQL\\Language\\AST\\DocumentNode, null, instance of Nuwave\\Lighthouse\\Schema\\Context, array(1), null, null, array(29))"
},
{
"file": "E:\\wwwroot\\object\\vendor\\nuwave\\lighthouse\\src\\GraphQL.php",
"line": 203,
"call": "Nuwave\\Lighthouse\\GraphQL::executeParsedQuery(instance of GraphQL\\Language\\AST\\DocumentNode, instance of Nuwave\\Lighthouse\\Schema\\Context, array(1), null, null)"
},
{
"file": "E:\\wwwroot\\object\\vendor\\nuwave\\lighthouse\\src\\GraphQL.php",
"line": 162,
"call": "Nuwave\\Lighthouse\\GraphQL::parseAndExecuteQuery('\n mutation CreateThemeAsset($input: ThemeAssetCreateInput!) {\n onlineStoreThemeAssetCreate(input: $input) {\n themeAsset {\n themeId\n key\n content\n }\n }\n }\n ', instance of Nuwave\\Lighthouse\\Schema\\Context, array(1), null, null)"
},
{
"file": "E:\\wwwroot\\object\\vendor\\nuwave\\lighthouse\\src\\GraphQL.php",
"line": 121,
"call": "Nuwave\\Lighthouse\\GraphQL::executeOperation(instance of GraphQL\\Server\\OperationParams, instance of Nuwave\\Lighthouse\\Schema\\Context)"
},
{
"file": "E:\\wwwroot\\object\\vendor\\nuwave\\lighthouse\\src\\Support\\Utils.php",
"line": 99,
"call": "Nuwave\\Lighthouse\\GraphQL::Nuwave\\Lighthouse\\{closure}(instance of GraphQL\\Server\\OperationParams)"
},
{
"file": "E:\\wwwroot\\object\\vendor\\nuwave\\lighthouse\\src\\GraphQL.php",
"line": 120,
"call": "Nuwave\\Lighthouse\\Support\\Utils::applyEach(instance of Closure, instance of GraphQL\\Server\\OperationParams)"
},
{
"file": "E:\\wwwroot\\object\\vendor\\nuwave\\lighthouse\\src\\Support\\Http\\Controllers\\GraphQLController.php",
"line": 32,
"call": "Nuwave\\Lighthouse\\GraphQL::executeOperationOrOperations(instance of GraphQL\\Server\\OperationParams, instance of Nuwave\\Lighthouse\\Schema\\Context)"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\ControllerDispatcher.php",
"line": 48,
"call": "Nuwave\\Lighthouse\\Support\\Http\\Controllers\\GraphQLController::__invoke(instance of Illuminate\\Http\\Request, instance of Nuwave\\Lighthouse\\GraphQL, instance of Illuminate\\Events\\Dispatcher, instance of Laragraph\\Utils\\RequestParser, instance of Nuwave\\Lighthouse\\Execution\\SingleResponse, instance of Nuwave\\Lighthouse\\Execution\\ContextFactory)"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Route.php",
"line": 219,
"call": "Illuminate\\Routing\\ControllerDispatcher::dispatch(instance of Illuminate\\Routing\\Route, instance of Nuwave\\Lighthouse\\Support\\Http\\Controllers\\GraphQLController, '__invoke')"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Route.php",
"line": 176,
"call": "Illuminate\\Routing\\Route::runController()"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php",
"line": 681,
"call": "Illuminate\\Routing\\Route::run()"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php",
"line": 130,
"call": "Illuminate\\Routing\\Router::Illuminate\\Routing\\{closure}(instance of Illuminate\\Http\\Request)"
},
{
"file": "E:\\wwwroot\\object\\vendor\\nuwave\\lighthouse\\src\\Support\\Http\\Middleware\\AttemptAuthentication.php",
"line": 34,
"call": "Illuminate\\Pipeline\\Pipeline::Illuminate\\Pipeline\\{closure}(instance of Illuminate\\Http\\Request)"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php",
"line": 171,
"call": "Nuwave\\Lighthouse\\Support\\Http\\Middleware\\AttemptAuthentication::handle(instance of Illuminate\\Http\\Request, instance of Closure)"
},
{
"file": "E:\\wwwroot\\object\\vendor\\nuwave\\lighthouse\\src\\Support\\Http\\Middleware\\AcceptJson.php",
"line": 27,
"call": "Illuminate\\Pipeline\\Pipeline::Illuminate\\Pipeline\\{closure}(instance of Illuminate\\Http\\Request)"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php",
"line": 171,
"call": "Nuwave\\Lighthouse\\Support\\Http\\Middleware\\AcceptJson::handle(instance of Illuminate\\Http\\Request, instance of Closure)"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php",
"line": 105,
"call": "Illuminate\\Pipeline\\Pipeline::Illuminate\\Pipeline\\{closure}(instance of Illuminate\\Http\\Request)"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php",
"line": 683,
"call": "Illuminate\\Pipeline\\Pipeline::then(instance of Closure)"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php",
"line": 658,
"call": "Illuminate\\Routing\\Router::runRouteWithinStack(instance of Illuminate\\Routing\\Route, instance of Illuminate\\Http\\Request)"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php",
"line": 624,
"call": "Illuminate\\Routing\\Router::runRoute(instance of Illuminate\\Http\\Request, instance of Illuminate\\Routing\\Route)"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php",
"line": 613,
"call": "Illuminate\\Routing\\Router::dispatchToRoute(instance of Illuminate\\Http\\Request)"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php",
"line": 170,
"call": "Illuminate\\Routing\\Router::dispatch(instance of Illuminate\\Http\\Request)"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php",
"line": 130,
"call": "Illuminate\\Foundation\\Http\\Kernel::Illuminate\\Foundation\\Http\\{closure}(instance of Illuminate\\Http\\Request)"
},
{
"file": "E:\\wwwroot\\object\\vendor\\barryvdh\\laravel-debugbar\\src\\Middleware\\InjectDebugbar.php",
"line": 60,
"call": "Illuminate\\Pipeline\\Pipeline::Illuminate\\Pipeline\\{closure}(instance of Illuminate\\Http\\Request)"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php",
"line": 171,
"call": "Barryvdh\\Debugbar\\Middleware\\InjectDebugbar::handle(instance of Illuminate\\Http\\Request, instance of Closure)"
},
{
"file": "E:\\wwwroot\\object\\app\\Http\\Middleware\\ChangeAppUrlMiddleware.php",
"line": 23,
"call": "Illuminate\\Pipeline\\Pipeline::Illuminate\\Pipeline\\{closure}(instance of Illuminate\\Http\\Request)"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php",
"line": 171,
"call": "App\\Http\\Middleware\\ChangeAppUrlMiddleware::handle(instance of Illuminate\\Http\\Request, instance of Closure)"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest.php",
"line": 21,
"call": "Illuminate\\Pipeline\\Pipeline::Illuminate\\Pipeline\\{closure}(instance of Illuminate\\Http\\Request)"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php",
"line": 171,
"call": "Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest::handle(instance of Illuminate\\Http\\Request, instance of Closure)"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest.php",
"line": 21,
"call": "Illuminate\\Pipeline\\Pipeline::Illuminate\\Pipeline\\{closure}(instance of Illuminate\\Http\\Request)"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php",
"line": 171,
"call": "Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest::handle(instance of Illuminate\\Http\\Request, instance of Closure)"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize.php",
"line": 27,
"call": "Illuminate\\Pipeline\\Pipeline::Illuminate\\Pipeline\\{closure}(instance of Illuminate\\Http\\Request)"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php",
"line": 171,
"call": "Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize::handle(instance of Illuminate\\Http\\Request, instance of Closure)"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode.php",
"line": 63,
"call": "Illuminate\\Pipeline\\Pipeline::Illuminate\\Pipeline\\{closure}(instance of Illuminate\\Http\\Request)"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php",
"line": 171,
"call": "Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode::handle(instance of Illuminate\\Http\\Request, instance of Closure)"
},
{
"file": "E:\\wwwroot\\object\\vendor\\fideloper\\proxy\\src\\TrustProxies.php",
"line": 57,
"call": "Illuminate\\Pipeline\\Pipeline::Illuminate\\Pipeline\\{closure}(instance of Illuminate\\Http\\Request)"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php",
"line": 171,
"call": "Fideloper\\Proxy\\TrustProxies::handle(instance of Illuminate\\Http\\Request, instance of Closure)"
},
{
"file": "E:\\wwwroot\\object\\vendor\\dingo\\api\\src\\Http\\Middleware\\Request.php",
"line": 111,
"call": "Illuminate\\Pipeline\\Pipeline::Illuminate\\Pipeline\\{closure}(instance of Illuminate\\Http\\Request)"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php",
"line": 171,
"call": "Dingo\\Api\\Http\\Middleware\\Request::handle(instance of Illuminate\\Http\\Request, instance of Closure)"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php",
"line": 105,
"call": "Illuminate\\Pipeline\\Pipeline::Illuminate\\Pipeline\\{closure}(instance of Illuminate\\Http\\Request)"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php",
"line": 145,
"call": "Illuminate\\Pipeline\\Pipeline::then(instance of Closure)"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php",
"line": 110,
"call": "Illuminate\\Foundation\\Http\\Kernel::sendRequestThroughRouter(instance of Illuminate\\Http\\Request)"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Testing\\Concerns\\MakesHttpRequests.php",
"line": 470,
"call": "Illuminate\\Foundation\\Http\\Kernel::handle(instance of Illuminate\\Http\\Request)"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Testing\\Concerns\\MakesHttpRequests.php",
"line": 442,
"call": "Illuminate\\Foundation\\Testing\\TestCase::call('POST', 'https://object.local/graphql', array(0), array(0), array(1), array(3), '{\"query\":\"\\n mutation CreateThemeAsset($input: ThemeAssetCreateInput!) {\\n onlineStoreThemeAssetCreate(input: $input) {\\n themeAsset {\\n themeId\\n key\\n content\\n }\\n }\\n }\\n \",\"variables\":{\"input\":{\"themeId\":\"vogue\",\"content\":\"string\",\"key\":\"js\\/20220307.9.js\"}}}')"
},
{
"file": "E:\\wwwroot\\object\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Testing\\Concerns\\MakesHttpRequests.php",
"line": 301,
"call": "Illuminate\\Foundation\\Testing\\TestCase::json('POST', 'https://object.local/graphql', array(2), array(3))"
},
{
"file": "E:\\wwwroot\\object\\vendor\\nuwave\\lighthouse\\src\\Testing\\MakesGraphQLRequests.php",
"line": 79,
"call": "Illuminate\\Foundation\\Testing\\TestCase::postJson('https://object.local/graphql', array(2), array(0))"
},
{
"file": "E:\\wwwroot\\object\\vendor\\nuwave\\lighthouse\\src\\Testing\\MakesGraphQLRequests.php",
"line": 62,
"call": "Modules\\ThemeStore\\Tests\\Functional\\GraphQl\\MutationThemeAssetGraphQlApiTest::postGraphQL(array(2), array(0))"
},
{
"file": "E:\\wwwroot\\object\\Modules\\ThemeStore\\Tests\\Functional\\GraphQl\\MutationThemeAssetGraphQlApiTest.php",
"line": 36,
"call": "Modules\\ThemeStore\\Tests\\Functional\\GraphQl\\MutationThemeAssetGraphQlApiTest::graphQL('\n mutation CreateThemeAsset($input: ThemeAssetCreateInput!) {\n onlineStoreThemeAssetCreate(input: $input) {\n themeAsset {\n themeId\n key\n content\n }\n }\n }\n ', array(1))"
},
{
"file": "E:\\wwwroot\\object\\vendor\\phpunit\\phpunit\\src\\Framework\\TestCase.php",
"line": 1154,
"call": "Modules\\ThemeStore\\Tests\\Functional\\GraphQl\\MutationThemeAssetGraphQlApiTest::testCreateThemeAsset()"
},
{
"file": "E:\\wwwroot\\object\\vendor\\phpunit\\phpunit\\src\\Framework\\TestCase.php",
"line": 842,
"call": "PHPUnit\\Framework\\TestCase::runTest()"
},
{
"file": "E:\\wwwroot\\object\\vendor\\phpunit\\phpunit\\src\\Framework\\TestResult.php",
"line": 693,
"call": "PHPUnit\\Framework\\TestCase::runBare()"
},
{
"file": "E:\\wwwroot\\object\\vendor\\phpunit\\phpunit\\src\\Framework\\TestCase.php",
"line": 796,
"call": "PHPUnit\\Framework\\TestResult::run(instance of Modules\\ThemeStore\\Tests\\Functional\\GraphQl\\MutationThemeAssetGraphQlApiTest(1))"
},
{
"file": "C:\\Users\\Lenovo\\AppData\\Local\\Temp\\PHP57E0.tmp",
"line": 261,
"call": "PHPUnit\\Framework\\TestCase::run(instance of PHPUnit\\Framework\\TestResult(1))"
},
{
"file": "C:\\Users\\Lenovo\\AppData\\Local\\Temp\\PHP57E0.tmp",
"line": 1040,
"function": "__phpunit_run_isolated_test()"
}
]
}
],
"data": {
"onlineStoreThemeAssetCreate": null
}
}].
Failed asserting that an array has the subset Array &0 (
'data' => Array &1 (
'onlineStoreThemeAssetCreate' => Array &2 (
'themeAsset' => Array &3 (
'themeId' => 'vogue'
'content' => 'string'
'key' => 'js/20220307.9.js'
)
)
)
).
--- Expected
+++ Actual
@@ @@
),
'data' =>
array (
- 'onlineStoreThemeAssetCreate' =>
- array (
- 'themeAsset' =>
- array (
- 'themeId' => 'vogue',
- 'content' => 'string',
- 'key' => 'js/20220307.9.js',
- ),
- ),
+ 'onlineStoreThemeAssetCreate' => NULL,
),
)
E:\wwwroot\object\vendor\laravel\framework\src\Illuminate\Foundation\Testing\Assert.php:108
E:\wwwroot\object\vendor\laravel\framework\src\Illuminate\Foundation\Testing\TestResponse.php:479
E:\wwwroot\object\Modules\ThemeStore\Tests\Functional\GraphQl\MutationThemeAssetGraphQlApiTest.php:43
FAILURES!
Tests: 1, Assertions: 1, Failures: 1.
PS E:\wwwroot\object>
7. Although a separate test database is now configured for test cases, there is no need to worry about affecting the development database. However, to avoid the problem of failing the test when multiple tests, it is decided to try to avoid duplication of request parameters. The value of the variable key is generated based on the timestamp. Example of its value: js/20220307144656.js. This ensures that the test can run every second and can pass. Later, you can add a method to test delete the records created by this entry in this test file. as shown in Figure 3

$input = [
'themeId' => 'vogue',
'content' => 'string',
'key' => 'js/' . date('YmdHis') . '.js',
];
需要长期技术维护或远程问题排查?
我是拥有 15+ 年经验的 PHP / Go 后端工程师,长期关注已有系统维护、Bug 修复、性能优化、服务器排查、WordPress 网站维护和小功能迭代。
如果你的项目遇到以下情况,可以先从一次小问题排查开始合作:
- ✅ PHP / Laravel / Yii2 老项目无人维护
- ✅ Go / Gin 后端接口需要排查或优化
- ✅ WordPress 网站访问慢、报错或插件冲突
- ✅ Nginx / MySQL / Redis / Linux 服务器异常
- ✅ CDN / Cloudflare / DNS / HTTPS 配置问题
- ✅ 需要长期远程技术支持或兼职维护
更多介绍请查看:关于我 & 合作
微信:13980074657
邮箱:shuijingwanwq@gmail.com
Telegram:@shuijingwan
GitHub:https://github.com/shuijingwan


发表回复