public function testWillImplementAnInterface()
 {
     $compiler = new ClassCompiler('Concise\\Mock\\ClassCompilerMock4');
     $this->assert($compiler->newInstance())->isAnInstanceOf('Concise\\Mock\\ClassCompilerMock4');
 }
 /**
  * @expectedException \InvalidArgumentException
  * @expectedExceptionMessage Expected string, but got integer for argument 1
  */
 public function testExposeMethodMustBeAString()
 {
     $compiler = new ClassCompiler('Concise\\Mock\\ClassCompilerMock1');
     $compiler->addExpose(123);
 }
Example #3
0
 /**
  * Compiler the mock into a usable instance.
  *
  * @return object
  */
 public function get()
 {
     $compiler = new ClassCompiler($this->className, $this->niceMock, $this->constructorArgs, $this->disableConstructor, $this->disableClone);
     if ($this->customClassName) {
         $compiler->setCustomClassName($this->customClassName);
     }
     $compiler->setRules($this->rules);
     foreach ($this->expose as $method) {
         $compiler->addExpose($method);
     }
     $mockInstance = $compiler->newInstance();
     $this->testCase->addMockInstance($this, $mockInstance);
     $this->restoreState($mockInstance);
     foreach ($this->properties as $name => $value) {
         $this->testCase->setProperty($mockInstance, $name, $value);
     }
     return $mockInstance;
 }