public function test_can_find_categories_with_columns() { $result = $this->repository->findBy('name', 'Category 1', ['name']); $this->assertCount(1, $result); $this->assertInstanceOf(Category::class, $result[0]); $this->assertNull($result[0]->description); }
public function test_can_clear_criterias() { $this->createCategoryDescription(); $criteria2 = new FindByName('Category B'); $criteria1 = new OrderDescById(); $this->repository->addCriteria($criteria1)->addCriteria($criteria2)->clearCriteria(); $this->assertInstanceOf(CategoryRepository::class, $this->repository->clearCriteria()); $result = $this->repository->findBy('description', 'Description'); $this->assertCount(3, $result); $reflectionClass = new \ReflectionClass($this->repository); $reflectionProperty = $reflectionClass->getProperty('model'); $reflectionProperty->setAccessible(true); $result = $reflectionProperty->getValue($this->repository); $this->assertInstanceOf(Category::class, $result); }