/** * @covers \Ixudra\Portfolio\Services\Factories\CustomerFactory::modify() */ public function testModify() { $customer = new Customer(array('name' => 'Foo')); $customer->save(); $input = array('name' => 'Bar'); $this->customerFactory->modify($customer, $input); $customerRepository = App::make('\\Ixudra\\Portfolio\\Repositories\\Eloquent\\EloquentCustomerRepository'); $this->assertEquals(1, $customerRepository->all()->count()); $this->assertEquals('Bar', $customerRepository->all()->first()->name); }
/** * @covers \Ixudra\Portfolio\Repositories\Eloquent\EloquentCustomerRepository::search() */ public function testSearch_usesPagination() { $customer1 = Customer::create(array('first_name' => 'Foo_first_name')); $customer2 = Customer::create(array('first_name' => 'Bar_first_name')); $customer3 = Customer::create(array('first_name' => 'Bar_first_name')); $customer4 = Customer::create(array('first_name' => 'Foo_first_name')); $customer5 = Customer::create(array('first_name' => 'Foz_first_name')); $filters = array(); $paginator = $this->customerRepository->search($filters, 2, true); $customers = $paginator->getCollection(); $this->assertCount(2, $customers); $this->assertCollectionWithOnlyInstancesOf('\\Ixudra\\Portfolio\\Models\\Customer', $customers); }