Example #1
0
 /**
  * Static shortcut to \Mockery\Container::mock(), first argument names the
  * mock
  *
  * @return \Mockery\MockInterface
  */
 public static function namedMock()
 {
     $args = func_get_args();
     $name = array_shift($args);
     $builder = new MockConfigurationBuilder();
     $builder->setName($name);
     array_unshift($args, $builder);
     return call_user_func_array(array(self::getContainer(), 'mock'), $args);
 }
Example #2
0
 /**
  * @test
  * @group issue/294
  * @expectedException Mockery\Exception\RuntimeException
  * @expectedExceptionMessage Could not load mock DateTime, class already exists
  */
 public function testThrowsWhenNamedMockClassExistsAndIsNotMockery()
 {
     $builder = new MockConfigurationBuilder();
     $builder->setName("DateTime");
     $mock = $this->container->mock($builder);
 }