Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ai
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
ai
Commits
41247ea9
Commit
41247ea9
authored
2 months ago
by
Marcus Johansson
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3489690
: Add an event that triggers on chat iterator consumption
parent
ba502d5a
No related branches found
No related tags found
1 merge request
!295
Resolve #3489690 "Add an event"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/src/Unit/Event/PostStreamingResponseEventTest.php
+44
-0
44 additions, 0 deletions
tests/src/Unit/Event/PostStreamingResponseEventTest.php
with
44 additions
and
0 deletions
tests/src/Unit/Event/PostStreamingResponseEventTest.php
0 → 100644
+
44
−
0
View file @
41247ea9
<?php
namespace
Drupal\Tests\ai\Unit\Event
;
use
Drupal\ai\Event\PostStreamingResponseEvent
;
use
PHPUnit\Framework\TestCase
;
/**
* Tests that the event function works.
*
* @group ai
* @covers \Drupal\ai\Event\PostStreamingResponseEvent
*/
class
PostStreamingResponseEventTest
extends
TestCase
{
/**
* Test get event id.
*/
public
function
testEventId
():
void
{
$event
=
$this
->
getEvent
();
$this
->
assertEquals
(
'unique_id'
,
$event
->
getRequestThreadId
());
}
/**
* Test get response.
*/
public
function
testResponse
():
void
{
$event
=
$this
->
getEvent
();
$this
->
assertEquals
(
'test'
,
$event
->
getOutput
());
}
/**
* Helper function to get the events.
*
* @return \Drupal\ai\Event\PostStreamingResponseEvent|\PHPUnit\Framework\MockObject\MockObject
* The event.
*/
public
function
getEvent
():
PostStreamingResponseEvent
{
return
new
PostStreamingResponseEvent
(
'unique_id'
,
'test'
,
[
'test'
=>
'test'
,
]);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment