Пример #1
0
 public function testInstantiationOfInstanceMockImportsExpectations()
 {
     \Mockery::setContainer($this->container);
     $m = $this->container->mock('overload:MyNamespace\\MyClass6');
     $m->shouldReceive('foo')->andReturn('bar');
     $instance = new \MyNamespace\MyClass6();
     $this->assertEquals('bar', $instance->foo());
     \Mockery::resetContainer();
 }
Пример #2
0
 public function testInstantiationOfInstanceMockImportsDefaultExpectationsInTheCorrectOrder()
 {
     Mockery::setContainer($this->container);
     $m = $this->container->mock('overload:MyNamespace\\MyClass6');
     $m->shouldReceive('foo')->andReturn(1)->byDefault();
     $m->shouldReceive('foo')->andReturn(2)->byDefault();
     $m->shouldReceive('foo')->andReturn(3)->byDefault();
     $instance = new MyNamespace\MyClass6();
     $this->assertEquals(3, $instance->foo());
     Mockery::resetContainer();
 }