1212 */
1313class MockClassTest extends \PHPUnit_Framework_TestCase
1414{
15+ use EasyMock;
16+
1517 /**
1618 * @test
1719 */
1820 public function should_mock_objects ()
1921 {
2022 /** @var ClassFixture $mock */
21- $ mock = EasyMock:: mock ('EasyMock\Test\Fixture\ClassFixture ' );
23+ $ mock = $ this -> easyMock ('EasyMock\Test\Fixture\ClassFixture ' );
2224
2325 $ this ->assertInstanceOf ('PHPUnit_Framework_MockObject_MockObject ' , $ mock );
2426 $ this ->assertNull ($ mock ->foo ());
@@ -30,7 +32,7 @@ public function should_mock_objects()
3032 public function should_mock_interfaces ()
3133 {
3234 /** @var InterfaceFixture $mock */
33- $ mock = EasyMock:: mock ('EasyMock\Test\Fixture\InterfaceFixture ' );
35+ $ mock = $ this -> easyMock ('EasyMock\Test\Fixture\InterfaceFixture ' );
3436
3537 $ this ->assertInstanceOf ('PHPUnit_Framework_MockObject_MockObject ' , $ mock );
3638 $ this ->assertNull ($ mock ->foo ());
@@ -42,7 +44,7 @@ public function should_mock_interfaces()
4244 public function not_mocked_methods_should_return_null ()
4345 {
4446 /** @var ClassFixture $mock */
45- $ mock = EasyMock:: mock ('EasyMock\Test\Fixture\ClassFixture ' );
47+ $ mock = $ this -> easyMock ('EasyMock\Test\Fixture\ClassFixture ' );
4648
4749 $ this ->assertNull ($ mock ->foo ());
4850 }
@@ -53,7 +55,7 @@ public function not_mocked_methods_should_return_null()
5355 public function should_mock_existing_method_with_a_value ()
5456 {
5557 /** @var ClassFixture $mock */
56- $ mock = EasyMock:: mock ('EasyMock\Test\Fixture\ClassFixture ' , array (
58+ $ mock = $ this -> easyMock ('EasyMock\Test\Fixture\ClassFixture ' , array (
5759 'foo ' => 'bar ' ,
5860 ));
5961
@@ -66,7 +68,7 @@ public function should_mock_existing_method_with_a_value()
6668 public function should_mock_existing_method_with_a_callback ()
6769 {
6870 /** @var ClassFixture $mock */
69- $ mock = EasyMock:: mock ('EasyMock\Test\Fixture\ClassFixture ' , array (
71+ $ mock = $ this -> easyMock ('EasyMock\Test\Fixture\ClassFixture ' , array (
7072 'foo ' => function () {
7173 return 'bar ' ;
7274 },
@@ -83,7 +85,7 @@ public function should_mock_existing_method_with_a_callback()
8385 public function should_mock_existing_method_to_throw_exception ()
8486 {
8587 /** @var ClassFixture $mock */
86- $ mock = EasyMock:: mock ('EasyMock\Test\Fixture\ClassFixture ' , array (
88+ $ mock = $ this -> easyMock ('EasyMock\Test\Fixture\ClassFixture ' , array (
8789 'foo ' => new CustomException ('My message ' ),
8890 ));
8991 $ mock ->foo ();
@@ -95,8 +97,8 @@ public function should_mock_existing_method_to_throw_exception()
9597 public function should_mock_new_methods_on_existing_mock ()
9698 {
9799 /** @var ClassFixture $mock */
98- $ mock = EasyMock:: mock ('EasyMock\Test\Fixture\ClassFixture ' );
99- $ mock = EasyMock:: mock ($ mock , array (
100+ $ mock = $ this -> easyMock ('EasyMock\Test\Fixture\ClassFixture ' );
101+ $ mock = $ this -> easyMock ($ mock , array (
100102 'foo ' => 'bar ' ,
101103 ));
102104
@@ -108,8 +110,10 @@ public function should_mock_new_methods_on_existing_mock()
108110 */
109111 public function should_allow_to_spy_method_calls ()
110112 {
111- $ mock = EasyMock:: spy ('EasyMock\Test\Fixture\ClassFixture ' , array (
113+ $ mock = $ this -> easySpy ('EasyMock\Test\Fixture\ClassFixture ' , array (
112114 'foo ' => 'bar ' ,
113115 ));
116+
117+ $ this ->assertEquals ('bar ' , $ mock ->foo ());
114118 }
115119}
0 commit comments