芝麻web文件管理V1.00
编辑当前文件:/home/shaabmuni/public_html/vendor/mockery/mockery/tests/Mockery/MockingProtectedMethodsTest.php
assertEquals("bar", $mock->bar()); } /** * @test * * This is a regression test, basically we don't want the mock handling * interfering with calling protected methods partials */ public function shouldAutomaticallyDeferCallsToProtectedMethodsForRuntimePartials() { $mock = mock("test\Mockery\TestWithProtectedMethods")->makePartial(); $this->assertEquals("bar", $mock->bar()); } /** @test */ public function shouldAutomaticallyIgnoreAbstractProtectedMethods() { $mock = mock("test\Mockery\TestWithProtectedMethods")->makePartial(); $this->assertNull($mock->foo()); } /** @test */ public function shouldAllowMockingProtectedMethods() { $mock = mock("test\Mockery\TestWithProtectedMethods") ->makePartial() ->shouldAllowMockingProtectedMethods(); $mock->shouldReceive("protectedBar")->andReturn("notbar"); $this->assertEquals("notbar", $mock->bar()); } /** @test */ public function shouldAllowMockingProtectedMethodOnDefinitionTimePartial() { $mock = mock("test\Mockery\TestWithProtectedMethods[protectedBar]") ->shouldAllowMockingProtectedMethods(); $mock->shouldReceive("protectedBar")->andReturn("notbar"); $this->assertEquals("notbar", $mock->bar()); } /** @test */ public function shouldAllowMockingAbstractProtectedMethods() { $mock = mock("test\Mockery\TestWithProtectedMethods") ->makePartial() ->shouldAllowMockingProtectedMethods(); $mock->shouldReceive("abstractProtected")->andReturn("abstractProtected"); $this->assertEquals("abstractProtected", $mock->foo()); } /** @test */ public function shouldAllowMockingIncreasedVisabilityMethods() { $mock = mock("test\Mockery\TestIncreasedVisibilityChild"); $mock->shouldReceive('foobar')->andReturn("foobar"); $this->assertEquals('foobar', $mock->foobar()); } } abstract class TestWithProtectedMethods { public function foo() { return $this->abstractProtected(); } abstract protected function abstractProtected(); public function bar() { return $this->protectedBar(); } protected function protectedBar() { return 'bar'; } } class TestIncreasedVisibilityParent { protected function foobar() { } } class TestIncreasedVisibilityChild extends TestIncreasedVisibilityParent { public function foobar() { } }