TYPO3 CMS  TYPO3_6-2
DriverRegistryTest.php
Go to the documentation of this file.
1 <?php
3 
23 
27  protected $fixture;
28 
29  public function setUp() {
30  $this->initializeFixture();
31  }
32 
33  protected function initializeFixture() {
34  $this->fixture = new \TYPO3\CMS\Core\Resource\Driver\DriverRegistry();
35  }
36 
41  $className = get_class($this->getMockForAbstractClass('TYPO3\\CMS\\Core\\Resource\\Driver\\AbstractDriver'));
42  $this->fixture->registerDriverClass($className, 'foobar');
43  $returnedClassName = $this->fixture->getDriverClass('foobar');
44  $this->assertEquals($className, $returnedClassName);
45  }
46 
51  $this->setExpectedException('InvalidArgumentException', '', 1314979197);
52  $this->fixture->registerDriverClass($this->getUniqueId());
53  }
54 
59  $this->setExpectedException('InvalidArgumentException', '', 1314979451);
60  $className = get_class($this->getMockForAbstractClass('TYPO3\\CMS\\Core\\Resource\\Driver\\AbstractDriver'));
61  $className2 = get_class($this->getMockForAbstractClass('TYPO3\\CMS\\Core\\Resource\\Driver\\DriverInterface'));
62  $this->fixture->registerDriverClass($className, 'foobar');
63  $this->fixture->registerDriverClass($className2, 'foobar');
64  }
65 
70  $this->setExpectedException('InvalidArgumentException', '', 1314085990);
71  $this->fixture->getDriverClass($this->getUniqueId());
72  }
73 
78  $className = get_class($this->getMockForAbstractClass('TYPO3\\CMS\\Core\\Resource\\Driver\\AbstractDriver'));
79  $this->fixture->registerDriverClass($className, 'foobar');
80  $this->assertEquals($className, $this->fixture->getDriverClass($className));
81  }
82 
87  $className = get_class($this->getMockForAbstractClass('TYPO3\\CMS\\Core\\Resource\\Driver\\AbstractDriver'));
88  $shortName = $this->getUniqueId();
89  $GLOBALS['TYPO3_CONF_VARS']['SYS']['fal']['registeredDrivers'] = array(
90  $shortName => array(
91  'class' => $className
92  )
93  );
94  $this->initializeFixture();
95  $this->assertEquals($className, $this->fixture->getDriverClass($shortName));
96  }
97 
102  $className = get_class($this->getMockForAbstractClass('TYPO3\\CMS\\Core\\Resource\\Driver\\AbstractDriver'));
103  $shortName = $this->getUniqueId();
104  $GLOBALS['TYPO3_CONF_VARS']['SYS']['fal']['registeredDrivers'] = array(
105  $shortName => array(
106  'class' => $className
107  )
108  );
109  $this->initializeFixture();
110  $this->assertTrue($this->fixture->driverExists($shortName));
111  $this->assertFalse($this->fixture->driverExists($this->getUniqueId()));
112  }
113 
118  $GLOBALS['TYPO3_CONF_VARS']['SYS']['fal']['registeredDrivers'] = array(
119  );
120  $this->initializeFixture();
121  $this->assertFalse($this->fixture->driverExists($this->getUniqueId()));
122  }
123 
124 }
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]