|
1
|
|
|
<?php |
|
2
|
|
|
/* |
|
3
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
4
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
5
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
|
6
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
|
7
|
|
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
8
|
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
9
|
|
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
|
10
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
|
11
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|
12
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
|
13
|
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
14
|
|
|
* |
|
15
|
|
|
* This software consists of voluntary contributions made by many individuals |
|
16
|
|
|
* and is licensed under the MIT license. For more information, see |
|
17
|
|
|
* <http://www.doctrine-project.org>. |
|
18
|
|
|
*/ |
|
19
|
|
|
|
|
20
|
|
|
namespace BaleenTest\Cli\CommandBus\Storage; |
|
21
|
|
|
|
|
22
|
|
|
use Baleen\Cli\CommandBus\Storage\AbstractStorageMessage; |
|
23
|
|
|
use Baleen\Cli\CommandBus\Storage\LatestMessage; |
|
24
|
|
|
use BaleenTest\Cli\CommandBus\MessageTestCase; |
|
25
|
|
|
use Mockery as m; |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* Class LatestMessageTest |
|
29
|
|
|
* @author Gabriel Somoza <[email protected]> |
|
30
|
|
|
*/ |
|
31
|
|
View Code Duplication |
class LatestMessageTest extends MessageTestCase |
|
32
|
|
|
{ |
|
33
|
|
|
/** |
|
34
|
|
|
* testConstructor |
|
35
|
|
|
*/ |
|
36
|
|
|
public function testConstructor() |
|
37
|
|
|
{ |
|
38
|
|
|
$instance = new LatestMessage(); |
|
39
|
|
|
$this->assertInstanceOf(AbstractStorageMessage::class, $instance); |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* getClassName must return a string with the FQN of the command class being tested |
|
44
|
|
|
* @return string |
|
45
|
|
|
*/ |
|
46
|
|
|
protected function getClassName() |
|
47
|
|
|
{ |
|
48
|
|
|
return LatestMessage::class; |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* Must return an array in the format: |
|
53
|
|
|
* |
|
54
|
|
|
* [ |
|
55
|
|
|
* 'name' => 'functionName', // required |
|
56
|
|
|
* 'with' => [arguments for with] // optional |
|
57
|
|
|
* 'return' => return value // optional, defaults to return self |
|
58
|
|
|
* 'times' => number of times it will be invoked |
|
59
|
|
|
* ] |
|
60
|
|
|
* |
|
61
|
|
|
* @return array |
|
62
|
|
|
*/ |
|
63
|
|
|
protected function getExpectations() |
|
64
|
|
|
{ |
|
65
|
|
|
return [ |
|
66
|
|
|
[ 'name' => 'setName', |
|
67
|
|
|
'with' => 'storage:latest', |
|
68
|
|
|
], |
|
69
|
|
|
[ 'name' => 'setDescription', |
|
70
|
|
|
'with' => m::type('string'), |
|
71
|
|
|
], |
|
72
|
|
|
]; |
|
73
|
|
|
} |
|
74
|
|
|
} |
|
75
|
|
|
|