コード例 #1
0
ファイル: MokkaTest.php プロジェクト: belanur/mokka
 /**
  * Since Mokka::mock() is static, this tests relies on the
  * correct function of the MockBuilder class
  */
 public function testMockReturnsExpectedMockObject()
 {
     $mock = Mokka::mock('\\Mokka\\Tests\\ClassStub');
     $this->assertInstanceOf('\\Mokka\\Tests\\ClassStub', $mock);
     $this->assertInstanceOf('\\Mokka\\Mock\\MockInterface', $mock);
 }
コード例 #2
0
ファイル: MockTest.php プロジェクト: belanur/mokka
 /**
  * @expectedException \InvalidArgumentException
  */
 public function testSubbedMethodThrowsException()
 {
     $mock = Mokka::mock('\\Mokka\\Tests\\Integration\\Fixtures\\SampleClass');
     Mokka::when($mock)->setBar()->thenThrow(new \InvalidArgumentException());
     $mock->setBar();
 }
コード例 #3
0
 /**
  * @expectedException \Mokka\VerificationException
  */
 public function testVerifiesThatMethodWasNotCalled()
 {
     $mock = Mokka::mock('\\Mokka\\Tests\\Integration\\Fixtures\\SampleClass');
     Mokka::verify($mock, new Never())->setBar();
     $mock->setBar();
 }