public function testSaveNewClientWithCompanyProfile() { $clientService = new ClientService(); $clientService->setEm($this->getDefaultEmMock()); $data = $this->getClientData(); $data['cnpj'] = '99.999.999/9999-99'; $saved = $clientService->save(json_encode($data)); $this->assertInternalType('object', $saved); $this->assertInstanceOf('Orcamentos\\Model\\Client', $saved); }
public function testSaveEditClient() { $clientService = new ClientService(); $clientService->setEm($this->getDefaultEmMock()); $data = array('name' => 'Apple', 'responsable' => 'Steve Jobs', 'email' => '*****@*****.**', 'companyId' => 1); $saved = $clientService->save(json_encode($data)); $this->assertEquals('Apple', $saved->getName()); $data = array('name' => 'Apple Store', 'responsable' => 'Steve Jobs', 'email' => '*****@*****.**', 'companyId' => 1, 'id' => 1); $saved = $clientService->save(json_encode($data)); $this->assertEquals('Apple Store', $saved->getName()); }
public function create(Request $request, Application $app) { $data = $request->request->all(); $logotype = $request->files->get('logotype'); $data['companyId'] = $app['session']->get('companyId'); $data = json_encode($data); $clientService = new ClientService(); $clientService->setEm($app['orm.em']); $client = $clientService->save($data, $logotype); return $app->redirect('/client/detail/' . $client->getId()); }