Exemple #1
0
 /** @group issue/175 */
 public function testExistingStaticMethodMocking()
 {
     \Mockery::setContainer($this->container);
     $mock = $this->container->mock('MockeryTest_PartialStatic[mockMe]');
     $mock->shouldReceive('mockMe')->with(5)->andReturn(10);
     $this->assertEquals(10, $mock::mockMe(5));
     $this->assertEquals(3, $mock::keepMe(3));
 }
Exemple #2
0
 /**
  * @issue issue/35
  */
 public function testCallingSelfOnlyReturnsLastMockCreatedOrCurrentMockBeingProgrammedSinceTheyAreOneAndTheSame()
 {
     \Mockery::setContainer($this->container);
     $m = $this->container->mock('MockeryTestFoo');
     $this->assertFalse($this->container->self() instanceof MockeryTestFoo2);
     //$m = $this->container->mock('MockeryTestFoo2');
     //$this->assertTrue($this->container->self() instanceof MockeryTestFoo2);
     //$m = $this->container->mock('MockeryTestFoo');
     //$this->assertFalse(\Mockery::self() instanceof MockeryTestFoo2);
     //$this->assertTrue(\Mockery::self() instanceof MockeryTestFoo);
     \Mockery::resetContainer();
 }
 /**
  * @issue issue/89
  */
 public function testCreatingMockOfClassWithExistingToStringMethodDoesntCreateClassWithTwoToStringMethods()
 {
     \Mockery::setContainer($this->container);
     $m = $this->container->mock('MockeryTest_WithToString');
     // this would fatal
     $m->shouldReceive("__toString")->andReturn('dave');
     $this->assertEquals("dave", "{$m}");
 }
Exemple #4
0
 /**
  * @issue issue/21
  */
 public function testClassDeclaringUnsetDoesNotThrowException()
 {
     \Mockery::setContainer($this->container);
     $m = $this->container->mock('MockeryTest_UnsetMethod');
     $this->container->mockery_verify();
     \Mockery::resetContainer();
 }