예제 #1
0
 public function testCloneWithCustomBackend()
 {
     $mockBackend = $this->mock(tubepress_spi_options_PersistenceBackendInterface::_);
     $actual = $this->_sut->getCloneWithCustomBackend($mockBackend);
     $this->assertInstanceOf('tubepress_options_impl_Persistence', $actual);
     $this->assertNotSame($this->_sut, $actual);
 }
예제 #2
0
 private function _buildFieldArrayForSingleSource(array $options, $hasErrors, $index)
 {
     if ($hasErrors && isset($this->_cachedGroupIds[$index])) {
         $groupId = $this->_cachedGroupIds[$index];
     } else {
         $groupId = mt_rand(100000, 1000000);
     }
     $prefix = "tubepress-multisource-{$groupId}-";
     $multiSourcePersistenceBackend = new tubepress_options_ui_impl_MultiSourcePersistenceBackend($options);
     $readOnlyPersistence = $this->_persistence->getCloneWithCustomBackend($multiSourcePersistenceBackend);
     $toReturn = array();
     $multiSourceFields = $this->_getMultiSourceFieldsFromProviders();
     foreach ($multiSourceFields as $multiSourceField) {
         $toReturn[] = $multiSourceField->cloneForMultiSource($prefix, $readOnlyPersistence);
     }
     return $toReturn;
 }