/**
  * @covers \Ixudra\Portfolio\Services\Factories\CompanyFactory::modify()
  * @covers \Ixudra\Portfolio\Services\Factories\CompanyFactory::extractCorporateAddressInput()
  * @covers \Ixudra\Portfolio\Services\Factories\CompanyFactory::extractCompanyInput()
  */
 public function testModify()
 {
     $company = new Company(array('name' => 'Foo_name', 'email' => '*****@*****.**', 'phone' => '011223344', 'street_1' => 'Foo_street_1', 'street_2' => 'Foo_street_2', 'number' => 15, 'box' => 'Foo_box', 'district' => 'Foo_district', 'postal_code' => 'Foo_postal_code', 'city' => 'Foo_city', 'country' => 'us'));
     $company->save();
     $input = array('name' => 'Bar_name', 'email' => '*****@*****.**', 'phone' => '022334455', 'street_1' => 'Bar_street_1', 'street_2' => 'Bar_street_2', 'number' => 17, 'box' => 'Bar_box', 'district' => 'Bar_district', 'postal_code' => 'Bar_postal_code', 'city' => 'Bar_city', 'country' => 'be');
     $this->companyFactory->modify($company, $input);
     $companyRepository = App::make('\\Ixudra\\Portfolio\\Repositories\\Eloquent\\EloquentCompanyRepository');
     $this->assertEquals(1, $companyRepository->all()->count());
     $this->assertEquals('Bar_name', $companyRepository->all()->first()->name);
     $addressRepository = App::make('\\Ixudra\\Portfolio\\Repositories\\Eloquent\\EloquentAddressRepository');
     $this->assertEquals(1, $addressRepository->all()->count());
     $this->assertEquals('Bar_street_1', $company->corporateAddress->street_1);
     $this->assertEquals('Bar_street_1', $company->billingAddress->street_1);
 }
 /**
  * @covers \Ixudra\Portfolio\Repositories\Eloquent\EloquentCompanyRepository::search()
  */
 public function testSearch_usesPagination()
 {
     $company1 = Company::create(array('name' => 'Foo_Company 1'));
     $company2 = Company::create(array('name' => 'Bar_Company 2'));
     $company3 = Company::create(array('name' => 'Bar_Company 3'));
     $company4 = Company::create(array('name' => 'Foo_Company 4'));
     $company5 = Company::create(array('name' => 'Foz_Company 5'));
     $filters = array();
     $paginator = $this->companyRepository->search($filters, 2, true);
     $companies = $paginator->getCollection();
     $this->assertCount(2, $companies);
     $this->assertCollectionWithOnlyInstancesOf('\\Ixudra\\Portfolio\\Models\\Company', $companies);
 }