Ejemplo n.º 1
0
 public function verifyWithAMock()
 {
     $mock = \Enhance\MockFactory::createMock('ExampleDependencyClass');
     $mock->addExpectation(\Enhance\Expect::method('getSomething')->with(1, 'Arg2')->returns('Something')->times(1));
     $target = new ExampleClass($mock);
     $result = $target->doSomething();
     $mock->verifyExpectations();
 }
Ejemplo n.º 2
0
 public function createMockWithSetPropertyExpectVerify()
 {
     $mock = \Enhance\MockFactory::createMock('ExampleClass');
     $mock->addExpectation(\Enhance\Expect::setProperty('Number')->with(5)->times(1));
     /** @noinspection PhpUndefinedFieldInspection */
     $mock->Number = 5;
     $mock->verifyExpectations();
 }