Exemple #1
0
 public function testAddsExpectedMethod()
 {
     $this->_mock->listenForVerification();
     $this->_mock->doFoo();
     $expectedMethod = new MockedMethod('doFoo', new ArgumentCollection(), new Once());
     $expected = new MethodCollection(new ArgumentComparator(new ComparatorLocator()));
     $expected->addMethod($expectedMethod);
     $this->assertAttributeEquals($expected, '_methods', $this->_mock);
     // Workaround to prevent a VerificationException on $expectedMethod
     $expectedMethod->call(new ArgumentCollection());
     $this->_mock->doFoo();
 }
 public function testCount()
 {
     $this->assertSame(0, $this->_collection->count());
     $this->_collection->addMethod(new StubbedMethod('doBar', new ArgumentCollection(), 'foo'));
     $this->assertSame(1, $this->_collection->count());
     $this->_collection->addMethod(new StubbedMethod('doFoo', new ArgumentCollection(), 'foo'));
     $this->assertSame(2, $this->_collection->count());
 }