|
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\Repository; |
|
21
|
|
|
|
|
22
|
|
|
use Baleen\Cli\CommandBus\AbstractMessage; |
|
23
|
|
|
use Baleen\Cli\CommandBus\Repository\AbstractRepositoryMessage; |
|
24
|
|
|
use Baleen\Cli\CommandBus\Util\ComparatorAwareInterface; |
|
25
|
|
|
use Baleen\Cli\CommandBus\Util\RepositoryAwareInterface; |
|
26
|
|
|
use Baleen\Migrations\Repository\RepositoryInterface; |
|
27
|
|
|
use Baleen\Migrations\Version; |
|
28
|
|
|
use BaleenTest\Cli\BaseTestCase; |
|
29
|
|
|
use League\Flysystem\Filesystem; |
|
30
|
|
|
use Mockery as m; |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* Class AbstractRepositoryMessageTest |
|
34
|
|
|
* @author Gabriel Somoza <[email protected]> |
|
35
|
|
|
*/ |
|
36
|
|
|
class AbstractRepositoryMessageTest extends BaseTestCase |
|
37
|
|
|
{ |
|
38
|
|
|
/** @var m\Mock|AbstractRepositoryMessage */ |
|
39
|
|
|
protected $instance; |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* setUp |
|
43
|
|
|
*/ |
|
44
|
|
|
public function setUp() |
|
45
|
|
|
{ |
|
46
|
|
|
parent::setUp(); |
|
47
|
|
|
$this->instance = m::mock(AbstractRepositoryMessage::class) |
|
48
|
|
|
->makePartial(); |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* testConstructor |
|
53
|
|
|
*/ |
|
54
|
|
|
public function testConstructor() |
|
55
|
|
|
{ |
|
56
|
|
|
$this->assertInstanceOf(AbstractMessage::class, $this->instance); |
|
57
|
|
|
$this->assertInstanceOf(RepositoryAwareInterface::class, $this->instance); |
|
58
|
|
|
$this->assertInstanceOf(ComparatorAwareInterface::class, $this->instance); |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
/** |
|
62
|
|
|
* testGetSetRepository |
|
63
|
|
|
*/ |
|
64
|
|
|
public function testGetSetRepository() |
|
65
|
|
|
{ |
|
66
|
|
|
/** @var m\Mock|RepositoryInterface $repository */ |
|
67
|
|
|
$repository = m::mock(RepositoryInterface::class); |
|
68
|
|
|
$this->instance->setRepository($repository); |
|
69
|
|
|
$this->assertSame($repository, $this->instance->getRepository()); |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
/** |
|
73
|
|
|
* testGetSetFilesystem |
|
74
|
|
|
*/ |
|
75
|
|
|
public function testGetSetFilesystem() |
|
76
|
|
|
{ |
|
77
|
|
|
/** @var m\Mock|Filesystem $filesystem */ |
|
78
|
|
|
$filesystem = m::mock(Filesystem::class); |
|
79
|
|
|
$this->instance->setFilesystem($filesystem); |
|
80
|
|
|
$this->assertSame($filesystem, $this->instance->getFilesystem()); |
|
81
|
|
|
} |
|
82
|
|
|
} |
|
83
|
|
|
|