Skip to content

Add set oauth bearer func #48

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 24, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add test
nick-zh committed Apr 24, 2021

Verified

This commit was signed with the committer’s verified signature.
JoshuaKGoldberg Josh Goldberg ✨
commit b4f5bd7291f3c05cab844af0647a59f1a7c0d870
24 changes: 24 additions & 0 deletions tests/set_oauthbearer_token.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
--TEST--
Produce, consume
--SKIPIF--
<?php
require __DIR__ . '/integration-tests-check.php';
--FILE--
<?php
require __DIR__ . '/integration-tests-check.php';

$conf = new SimpleKafkaClient\Configuration();
$conf->set('metadata.broker.list', getenv('TEST_KAFKA_BROKERS'));
$conf->set('security.protocol', 'SASL_PLAINTEXT');
$conf->set('sasl.mechanisms', 'OAUTHBEARER');

$conf->setErrorCb(function($kafka, $errorCode, $errorString) {
var_dump($errorString);
});

$producer = new SimpleKafkaClient\Producer($conf);
$producer->setOAuthBearerToken('token', 100000 + microtime() * 1000, 'principal', ['test'=>'key']);
$producer->poll(-1);
echo 'Done';
--EXPECT--
Done