forked from ppy/osu-web
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request ppy#11165 from notbakaneko/queue-datadog-log-comma…
…nd-name Use command name instead of display name in datadog metric
- Loading branch information
Showing
3 changed files
with
56 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the GNU Affero General Public License v3.0. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tests\Jobs; | ||
|
||
use Illuminate\Queue\Events\JobProcessed; | ||
use Queue; | ||
use Tests\TestCase; | ||
|
||
class JobNameTest extends TestCase | ||
{ | ||
public function testDisplayName() | ||
{ | ||
$job = new TestJob('test'); | ||
|
||
Queue::after(function (JobProcessed $event) use ($job) { | ||
$payload = $event->job->payload(); | ||
$this->assertSame($job::class, $payload['data']['commandName']); | ||
$this->assertSame($job->displayName(), $payload['displayName']); | ||
}); | ||
|
||
dispatch($job); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the GNU Affero General Public License v3.0. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
namespace Tests\Jobs; | ||
|
||
use Illuminate\Bus\Queueable; | ||
use Illuminate\Contracts\Queue\ShouldQueue; | ||
|
||
class TestJob implements ShouldQueue | ||
{ | ||
use Queueable; | ||
|
||
public function __construct(private $name) | ||
{ | ||
} | ||
|
||
public function displayName() | ||
{ | ||
return $this->name; | ||
} | ||
|
||
public function handle() | ||
{ | ||
} | ||
} |