public function getTypeObject() { $class = substr(get_called_class(), strrpos(get_called_class(), '\\') + 1); $class = substr($class, 0, strpos($class, 'Configuration')); $handle = uncamelcase($class); return \Concrete\Core\File\StorageLocation\Type\Type::getByHandle($handle); }
public function testCreateType() { $type = Type::add('local', t('Local Storage')); $this->assertInstanceOf('\\Concrete\\Core\\File\\StorageLocation\\Type\\Type', $type); $this->assertEquals('Local Storage', $type->getName()); $this->assertEquals(1, $type->getID()); $this->assertEquals(0, $type->getPackageID()); $this->assertEquals('local', $type->getHandle()); $type2 = Type::getByHandle('local'); $this->assertEquals($type, $type2); }
public function testGetByDefault() { $this->getStorageLocation(); $type = Type::getByHandle('local'); $configuration = $type->getConfigurationObject(); StorageLocation::add($configuration, 'Other Storage'); $location = StorageLocation::getDefault(); $this->assertInstanceOf('\\Concrete\\Core\\File\\StorageLocation\\StorageLocation', $location); $this->assertEquals(true, $location->isDefault()); $this->assertEquals('Default', $location->getName()); $alternate = StorageLocation::getByID(2); $this->assertInstanceOf('\\Concrete\\Core\\File\\StorageLocation\\StorageLocation', $alternate); $this->assertEquals(false, $alternate->isDefault()); $this->assertEquals('Other Storage', $alternate->getName()); }