From f2d26f16e9db0ddc612864a51b762fab8d7b24ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=B5=D1=80=D1=88=D0=B8=D0=BD=D0=B8=D0=BD=20=D0=A1?= =?UTF-8?q?=D0=B5=D1=80=D0=B3=D0=B5=D0=B9=20=D0=9E=D0=BB=D0=B5=D0=B3=D0=BE?= =?UTF-8?q?=D0=B2=D0=B8=D1=87?= Date: Wed, 3 Oct 2018 18:19:35 +0300 Subject: [PATCH 1/4] [STOMP] make getStomp public --- pkg/stomp/StompContext.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/stomp/StompContext.php b/pkg/stomp/StompContext.php index 596eacba5..e03b11cb6 100644 --- a/pkg/stomp/StompContext.php +++ b/pkg/stomp/StompContext.php @@ -186,7 +186,7 @@ public function purgeQueue(Queue $queue): void throw PurgeQueueNotSupportedException::providerDoestNotSupportIt(); } - private function getStomp(): BufferedStompClient + public function getStomp(): BufferedStompClient { if (false == $this->stomp) { $stomp = call_user_func($this->stompFactory); From 1a8e44e62813724e5859255e624697cf28bb821a Mon Sep 17 00:00:00 2001 From: versh23 Date: Wed, 3 Oct 2018 21:54:57 +0300 Subject: [PATCH 2/4] add test --- pkg/stomp/Tests/StompConnectionFactoryTest.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkg/stomp/Tests/StompConnectionFactoryTest.php b/pkg/stomp/Tests/StompConnectionFactoryTest.php index 18a13463f..b6abc7719 100644 --- a/pkg/stomp/Tests/StompConnectionFactoryTest.php +++ b/pkg/stomp/Tests/StompConnectionFactoryTest.php @@ -2,6 +2,7 @@ namespace Enqueue\Stomp\Tests; +use Enqueue\Stomp\BufferedStompClient; use Enqueue\Stomp\StompConnectionFactory; use Enqueue\Stomp\StompContext; use Enqueue\Test\ClassExtensionTrait; @@ -27,4 +28,13 @@ public function testShouldCreateLazyContext() $this->assertAttributeEquals(null, 'stomp', $context); $this->assertInternalType('callable', $this->readAttribute($context, 'stompFactory')); } + + public function testShouldGetBufferedStompClient() + { + $factory = new StompConnectionFactory(); + + $context = $factory->createContext(); + + $this->assertInstanceOf(BufferedStompClient::class, $context->getStomp()); + } } From 3f5e9c3acbfa4e5d39cc15f01f01c3348094090d Mon Sep 17 00:00:00 2001 From: versh23 Date: Wed, 3 Oct 2018 22:04:30 +0300 Subject: [PATCH 3/4] fix --- pkg/stomp/Tests/StompConnectionFactoryTest.php | 9 --------- pkg/stomp/Tests/StompContextTest.php | 7 +++++++ 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/pkg/stomp/Tests/StompConnectionFactoryTest.php b/pkg/stomp/Tests/StompConnectionFactoryTest.php index b6abc7719..4a2e2566e 100644 --- a/pkg/stomp/Tests/StompConnectionFactoryTest.php +++ b/pkg/stomp/Tests/StompConnectionFactoryTest.php @@ -28,13 +28,4 @@ public function testShouldCreateLazyContext() $this->assertAttributeEquals(null, 'stomp', $context); $this->assertInternalType('callable', $this->readAttribute($context, 'stompFactory')); } - - public function testShouldGetBufferedStompClient() - { - $factory = new StompConnectionFactory(); - - $context = $factory->createContext(); - - $this->assertInstanceOf(BufferedStompClient::class, $context->getStomp()); - } } diff --git a/pkg/stomp/Tests/StompContextTest.php b/pkg/stomp/Tests/StompContextTest.php index 036491b63..49297d3e1 100644 --- a/pkg/stomp/Tests/StompContextTest.php +++ b/pkg/stomp/Tests/StompContextTest.php @@ -213,6 +213,13 @@ public function testCreateTemporaryQueuesWithUniqueNames() $this->assertNotEquals($fooTempQueue->getStompName(), $barTempQueue->getStompName()); } + public function testShouldGetBufferedStompClient() + { + $context = new StompContext($this->createStompClientMock()); + + $this->assertInstanceOf(BufferedStompClient::class, $context->getStomp()); + } + /** * @return \PHPUnit_Framework_MockObject_MockObject|BufferedStompClient */ From 17337e36be104e0d82c7fec243fcc5c8cc20a809 Mon Sep 17 00:00:00 2001 From: versh23 Date: Wed, 3 Oct 2018 22:12:35 +0300 Subject: [PATCH 4/4] phpcs --- pkg/stomp/Tests/StompConnectionFactoryTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/pkg/stomp/Tests/StompConnectionFactoryTest.php b/pkg/stomp/Tests/StompConnectionFactoryTest.php index 4a2e2566e..18a13463f 100644 --- a/pkg/stomp/Tests/StompConnectionFactoryTest.php +++ b/pkg/stomp/Tests/StompConnectionFactoryTest.php @@ -2,7 +2,6 @@ namespace Enqueue\Stomp\Tests; -use Enqueue\Stomp\BufferedStompClient; use Enqueue\Stomp\StompConnectionFactory; use Enqueue\Stomp\StompContext; use Enqueue\Test\ClassExtensionTrait;