public function setUp() { parent::setUp(); $this->proxy = new ResultPrinterProxy($this->getMuteResultPrinter()); $this->test = $this->mock('PHPUnit_Framework_TestCase')->stub('getName')->get(); $this->e = $this->mock('Exception')->get(); }
public function setUp() { parent::setUp(); $this->issue = new RenderIssue(); $this->test = $this->mock('PHPUnit_Framework_TestCase')->stub(array('getName' => 'foo'))->get(); $this->exception = new Exception('foo bar'); }
public function __call($words, $args) { if (null !== $words) { $this->syntax .= strtolower(preg_replace('/([A-Z])/', ' $1', $words)) . ' '; } if (count($args) > 0) { $this->data[] = $args[0]; $this->syntax .= '? '; } try { $syntax = ModuleManager::getInstance()->getSyntaxCache()->getSyntax($this->getSyntax()); } catch (Exception $e) { $syntax = null; } if ($syntax) { self::$lastBuilder = null; $class = $syntax->getClass(); /** @var AbstractModule $instance */ $instance = new $class(); $data = $this->getData(); $types = $syntax->getArgumentTypes(); $checker = new DataTypeChecker(); for ($i = 0; $i < count($types); ++$i) { try { $data[$i] = $checker->check($types[$i], $data[$i]); } catch (DataTypeMismatchException $e) { $renderer = new ValueRenderer(); throw new Exception("Argument " . ($i + 1) . ' (' . $renderer->render($data[$i]) . ') must be ' . implode(' or ', $types[$i]) . '.'); } } $instance->setData($data); $instance->syntax = $syntax; try { $instance->{$syntax->getMethod()}(); $this->testCase->assertTrue(true); } catch (DidNotMatchException $e) { $this->handleFailure($e, $instance); } } return $this; }
protected function validateExpectation($mock, $method, array $rule) { $this->resetCallGraph(); if (null === $rule['with']) { /** @var $instance \Concise\Mock\MockInterface */ $instance = $mock['instance']; $this->validateSingleWith($rule, count($instance->getCallsForMethod($method)), $method); } else { $this->validateMultiWith($method, $rule, $mock); } $this->testCase->assertTrue(true); }
/** * 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; }
public function setUp() { parent::setUp(); $this->module = new MyMatcher(); }
public function setUp() { parent::setUp(); $this->matcher = new ArgumentMatcher(); }
public function setUp() { parent::setUp(); $this->dataTypeChecker = new DataTypeChecker(); }
public function setUp() { parent::setUp(); $this->converter = new NumberToTimesConverter(); }
public function setUp() { parent::setUp(); self::$didRun[] = $this->getName(); }
public function setUp() { parent::setUp(); $this->mock('PHPUnit_Framework_Test')->get(); }
public function setUp() { parent::setUp(); $this->builder = new PrototypeBuilder(); }
public function setUp() { parent::setUp(); $this->e = new Exception(); $this->test = $this->mock('PHPUnit_Framework_TestCase')->stub('getName')->get(); }
public function setUp() { parent::setUp(); $this->simplifier = new TraceSimplifier(); }
public function setUp() { parent::setUp(); $this->resultPrinter = new DefaultResultPrinterStub(); }
public function setUp() { parent::setUp(); $this->command = new Command(); }
public function setUp() { parent::setUp(); $this->compiler = new ClassCompiler('\\Concise\\Mock\\ClassCompilerMock3', true); }
public function setUp() { parent::setUp(); $this->formatter = new TimeFormatter(); }
public function setUp() { parent::setUp(); $this->descriptor = new ValueDescriptor(); }
public function setUp() { parent::setUp(); $this->parser = new ModuleManager(); }
public function setUp() { parent::setUp(); $this->renderer = new ValueRenderer(); }
public function setUp() { parent::setUp(); $this->resultPrinter = $this->niceMock('Concise\\Console\\ResultPrinter\\AbstractResultPrinter')->get(); }
public function setUp() { parent::setUp(); $this->renderer = new SyntaxRenderer(); }
/** * Invoked after the test suite has ran, allowing for the display of * test results and related statistics. */ public function afterRun() { TestCase::tearDownAfterClass(); }
public function setUp() { parent::setUp(); $this->proxy = new ResultPrinterProxy($this->getMuteResultPrinter()); }