Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaud-lb committed Jun 26, 2020
1 parent 964dbb2 commit e3bc8c2
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/init_transaction_not_configured.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
--TEST--
initTransaction() not configured
--SKIPIF--
<?php
require __DIR__ . '/integration-tests-check.php';
if (!class_exists("RdKafka\\KafkaErrorException")) {
echo "skip";
}
--FILE--
<?php
require __DIR__ . '/integration-tests-check.php';

$conf = new RdKafka\Conf();
if (RD_KAFKA_VERSION >= 0x090000 && false !== getenv('TEST_KAFKA_BROKER_VERSION')) {
$conf->set('broker.version.fallback', getenv('TEST_KAFKA_BROKER_VERSION'));
}

$conf->set('metadata.broker.list', getenv('TEST_KAFKA_BROKERS'));

$producer = new RdKafka\Producer($conf);

$producer->initTransactions(10000);
--EXPECTF--
Fatal error: Uncaught RdKafka\KafkaErrorException: _NOT_CONFIGURED in %s/tests/init_transaction_not_configured.php:13
Stack trace:
#0 %s/tests/init_transaction_not_configured.php(13): RdKafka\Producer->initTransactions(10000)
#1 {main}
thrown in %s/tests/init_transaction_not_configured.php on line 13

0 comments on commit e3bc8c2

Please sign in to comment.