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();
 }
Пример #2
0
 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');
 }
Пример #3
0
 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;
 }
Пример #4
0
 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);
 }
Пример #5
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;
 }
Пример #6
0
 public function setUp()
 {
     parent::setUp();
     $this->module = new MyMatcher();
 }
Пример #7
0
 public function setUp()
 {
     parent::setUp();
     $this->matcher = new ArgumentMatcher();
 }
Пример #8
0
 public function setUp()
 {
     parent::setUp();
     $this->dataTypeChecker = new DataTypeChecker();
 }
 public function setUp()
 {
     parent::setUp();
     $this->converter = new NumberToTimesConverter();
 }
Пример #10
0
 public function setUp()
 {
     parent::setUp();
     self::$didRun[] = $this->getName();
 }
 public function setUp()
 {
     parent::setUp();
     $this->mock('PHPUnit_Framework_Test')->get();
 }
Пример #12
0
 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();
 }
Пример #14
0
 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);
 }
Пример #18
0
 public function setUp()
 {
     parent::setUp();
     $this->formatter = new TimeFormatter();
 }
Пример #19
0
 public function setUp()
 {
     parent::setUp();
     $this->descriptor = new ValueDescriptor();
 }
Пример #20
0
 public function setUp()
 {
     parent::setUp();
     $this->parser = new ModuleManager();
 }
Пример #21
0
 public function setUp()
 {
     parent::setUp();
     $this->renderer = new ValueRenderer();
 }
 public function setUp()
 {
     parent::setUp();
     $this->resultPrinter = $this->niceMock('Concise\\Console\\ResultPrinter\\AbstractResultPrinter')->get();
 }
Пример #23
0
 public function setUp()
 {
     parent::setUp();
     $this->renderer = new SyntaxRenderer();
 }
Пример #24
0
 /**
  * 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());
 }