Skip to content

Commit 94f832b

Browse files
committed
Merge pull request php-amqplib#171 from asgrim/fix-for-undefined-property-warning-when-mocking
Fixes a warning that gets emitted when mocking AMQPChannel with some methods
2 parents d829473 + 6028635 commit 94f832b

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

PhpAmqpLib/Channel/AMQPChannel.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ class AMQPChannel extends AbstractChannel
7575
*/
7676
private $publish_cache_max_size;
7777

78+
/**
79+
* Whether or not the channel has been "opened" or not
80+
* @var bool
81+
*/
82+
protected $is_open = false;
7883

7984

8085
public function __construct($connection, $channel_id = null, $auto_decode = true)
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
namespace PhpAmqpLib\Tests\Unit\Channel;
4+
5+
use PhpAmqpLib\Channel\AMQPChannel;
6+
7+
class AMQPChannelTest extends \PHPUnit_Framework_TestCase
8+
{
9+
public function testCloseDoesNotEmitUndefinedPropertyWarningWhenSomeMethodsAreMocked()
10+
{
11+
$mockChannel = $this->getMockBuilder('\PhpAmqpLib\Channel\AMQPChannel')
12+
->setMethods(array('queue_bind'))
13+
->disableOriginalConstructor()
14+
->getMock();
15+
/* @var $mockChannel \PhpAmqpLib\Channel\AMQPChannel */
16+
17+
$mockChannel->close();
18+
}
19+
}

0 commit comments

Comments
 (0)