public function testLoadsResourceType() { $rows = new ResourceTypeRow(); $rows->With(1, 'resourcetype1', 'description'); $car = new CustomAttributeValueRow(); $car->With(1, 'value')->With(2, 'value2'); $this->db->SetRow(0, $rows->Rows()); $this->db->SetRow(1, $car->Rows()); $resourceType = $this->repository->LoadResourceType(123); $this->assertEquals(1, $resourceType->Id()); $this->assertEquals('resourcetype1', $resourceType->Name()); $this->assertTrue($this->db->ContainsCommand(new GetResourceTypeCommand(123))); $this->assertTrue($this->db->ContainsCommand(new GetAttributeValuesCommand(123, CustomAttributeCategory::RESOURCE_TYPE))); $this->assertEquals('value', $resourceType->GetAttributeValue(1)); $this->assertEquals('value2', $resourceType->GetAttributeValue(2)); }
public function PageLoad() { $resourceId = $this->page->GetResourceId(); $resource = $this->resourceRepository->LoadById($resourceId); $this->page->BindResource($resource); $attributeList = $this->attributeService->GetAttributes(CustomAttributeCategory::RESOURCE, $resourceId); $this->page->BindAttributes($attributeList->GetAttributes($resourceId)); if ($resource->HasResourceType()) { $resourceType = $this->resourceRepository->LoadResourceType($resource->GetResourceTypeId()); $attributeList = $this->attributeService->GetAttributes(CustomAttributeCategory::RESOURCE_TYPE, $resource->GetResourceTypeId()); $this->page->BindResourceType($resourceType, $attributeList->GetAttributes($resource->GetResourceTypeId())); } }