Conditions | 1 |
Paths | 1 |
Total Lines | 51 |
Code Lines | 39 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
61 | public function testInitializeWithDeadLetterExchangeAndNoDeadLetterRoutingKey() |
||
62 | { |
||
63 | list($backend, $channelMock) = $this->getBackendAndChannelMock(false, self::DEAD_LETTER_EXCHANGE); |
||
64 | |||
65 | $channelMock->expects($this->exactly(2)) |
||
66 | ->method('exchange_declare') |
||
67 | ->withConsecutive( |
||
68 | array( |
||
69 | $this->equalTo(self::EXCHANGE), |
||
70 | $this->equalTo('direct'), |
||
71 | $this->isType('boolean'), |
||
72 | $this->isType('boolean'), |
||
73 | $this->isType('boolean'), |
||
74 | ), |
||
75 | array( |
||
76 | $this->equalTo(self::DEAD_LETTER_EXCHANGE), |
||
77 | $this->equalTo('direct'), |
||
78 | $this->isType('boolean'), |
||
79 | $this->isType('boolean'), |
||
80 | $this->isType('boolean'), |
||
81 | ) |
||
82 | ); |
||
83 | $channelMock->expects($this->once()) |
||
84 | ->method('queue_declare') |
||
85 | ->with($this->equalTo(self::QUEUE), |
||
86 | $this->isType('boolean'), |
||
87 | $this->isType('boolean'), |
||
88 | $this->isType('boolean'), |
||
89 | $this->isType('boolean'), |
||
90 | $this->isType('boolean'), |
||
91 | $this->equalTo(array( |
||
92 | 'x-dead-letter-exchange' => array('S', self::DEAD_LETTER_EXCHANGE), |
||
93 | )) |
||
94 | ); |
||
95 | $channelMock->expects($this->exactly(2)) |
||
96 | ->method('queue_bind') |
||
97 | ->withConsecutive( |
||
98 | array( |
||
99 | $this->equalTo(self::QUEUE), |
||
100 | $this->equalTo(self::EXCHANGE), |
||
101 | $this->equalTo(self::KEY), |
||
102 | ), |
||
103 | array( |
||
104 | $this->equalTo(self::QUEUE), |
||
105 | $this->equalTo(self::DEAD_LETTER_EXCHANGE), |
||
106 | $this->equalTo(self::KEY), |
||
107 | ) |
||
108 | ); |
||
109 | |||
110 | $backend->initialize(); |
||
111 | } |
||
112 | |||
186 |