Esempio n. 1
0
 public function testProcessWithoutContactViewPermission()
 {
     $this->request->setMethod('POST');
     $this->form->expects($this->once())->method('setData')->with($this->entity);
     $this->form->expects($this->once())->method('submit')->with($this->request);
     $this->form->expects($this->once())->method('isValid')->will($this->returnValue(true));
     $this->form->expects($this->never())->method('get');
     $this->assertTrue($this->handler->process($this->entity));
 }
Esempio n. 2
0
 public function testProcessWithoutContactViewPermission()
 {
     $this->request->setMethod('POST');
     $this->form->expects($this->once())->method('setData')->with($this->entity);
     $this->form->expects($this->once())->method('submit')->with($this->request);
     $this->form->expects($this->once())->method('isValid')->will($this->returnValue(true));
     $this->form->expects($this->once())->method('has')->with('contacts')->will($this->returnValue(false));
     $this->form->expects($this->never())->method('get');
     $this->assertTrue($this->handler->process($this->entity));
     $actualContacts = $this->entity->getContacts()->toArray();
     $this->assertCount(0, $actualContacts);
     $this->assertEquals(array(), $actualContacts);
 }