1 | <?php |
||
14 | * @group Location |
||
15 | */ |
||
16 | class TestLocationModel extends TestCase { |
||
17 | |||
18 | /** |
||
19 | * @var Location_Model |
||
20 | */ |
||
21 | private $_location; |
||
22 | |||
23 | public function setUp() { |
||
24 | $this->_location = new Location_Model(array('location' => $this->_getMockLocation())); |
||
25 | parent::setUp(); |
||
26 | } |
||
27 | |||
28 | /** |
||
29 | * @covers ::__construct |
||
30 | * @covers ::__call |
||
31 | */ |
||
32 | public function testConstruct() { |
||
33 | $this->assertEquals(self::_getMockLocation(), $this->_location->location()); |
||
34 | } |
||
35 | |||
36 | /** |
||
37 | * @covers ::__construct |
||
38 | * @covers ::__call |
||
39 | */ |
||
40 | public function testConstructDefaults() { |
||
41 | $location = new Location_Model(); |
||
42 | $this->assertTrue($location->has_location()); |
||
43 | $this->assertInstanceOf(Loc::class, $location->location()); |
||
44 | } |
||
45 | |||
46 | /** |
||
47 | * @covers ::__construct |
||
48 | * @covers ::has_location |
||
49 | */ |
||
50 | public function testHasLocation() { |
||
51 | $this->assertTrue($this->_location->has_location()); |
||
52 | } |
||
53 | |||
54 | /** |
||
55 | * @covers ::__call |
||
56 | */ |
||
57 | public function testMagicMethodCall() { |
||
58 | $this->assertEquals('bar', $this->_location->foo()); |
||
59 | } |
||
60 | |||
61 | /** |
||
62 | * @covers ::__call |
||
63 | */ |
||
64 | public function testMagicMethodCallNull() { |
||
65 | $location = new Location_Model(array('location' => null)); |
||
66 | $this->assertNull($location->latitude()); |
||
67 | } |
||
68 | |||
69 | /** |
||
70 | * @return \Mockery\MockInterface |
||
71 | */ |
||
72 | private function _getMockLocation() { |
||
73 | $location = \Mockery::mock(MLoc::class); |
||
74 | |||
79 | } |