コード例 #1
0
 /**
  * Creates a fake extension with a given table definition.
  *
  * @param string $tableDefinition SQL script to create the extension's tables
  * @throws \RuntimeException
  * @return void
  */
 protected function createFakeExtension($tableDefinition)
 {
     // Prepare a fake extension configuration
     $ext_tables = GeneralUtility::tempnam('ext_tables');
     if (!GeneralUtility::writeFile($ext_tables, $tableDefinition)) {
         throw new \RuntimeException('Can\'t write temporary ext_tables file.');
     }
     $this->temporaryFiles[] = $ext_tables;
     $GLOBALS['TYPO3_LOADED_EXT'] = array('test_dbal' => array('ext_tables.sql' => $ext_tables));
     // Append our test table to the list of existing tables
     $this->subject->initialize();
 }
コード例 #2
0
 /**
  * @test
  */
 public function standardTagAttributesAreRegistered()
 {
     $mockTagBuilder = $this->getMock('TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\TagBuilder', array('addAttribute'), array(), '', FALSE);
     $mockTagBuilder->expects($this->at(0))->method('addAttribute')->with('class', 'classAttribute');
     $mockTagBuilder->expects($this->at(1))->method('addAttribute')->with('dir', 'dirAttribute');
     $mockTagBuilder->expects($this->at(2))->method('addAttribute')->with('id', 'idAttribute');
     $mockTagBuilder->expects($this->at(3))->method('addAttribute')->with('lang', 'langAttribute');
     $mockTagBuilder->expects($this->at(4))->method('addAttribute')->with('style', 'styleAttribute');
     $mockTagBuilder->expects($this->at(5))->method('addAttribute')->with('title', 'titleAttribute');
     $mockTagBuilder->expects($this->at(6))->method('addAttribute')->with('accesskey', 'accesskeyAttribute');
     $mockTagBuilder->expects($this->at(7))->method('addAttribute')->with('tabindex', 'tabindexAttribute');
     $this->viewHelper->_set('tag', $mockTagBuilder);
     $arguments = array('class' => 'classAttribute', 'dir' => 'dirAttribute', 'id' => 'idAttribute', 'lang' => 'langAttribute', 'style' => 'styleAttribute', 'title' => 'titleAttribute', 'accesskey' => 'accesskeyAttribute', 'tabindex' => 'tabindexAttribute');
     $this->viewHelper->_call('registerUniversalTagAttributes');
     $this->viewHelper->setArguments($arguments);
     $this->viewHelper->initializeArguments();
     $this->viewHelper->initialize();
 }
コード例 #3
0
 /**
  * @test
  */
 public function renderSetsCheckedAttributeForListOfObjects()
 {
     $mockTagBuilder = $this->getMock(TagBuilder::class, array('setTagName', 'addAttribute'));
     $mockTagBuilder->expects($this->at(1))->method('addAttribute')->with('type', 'checkbox');
     $mockTagBuilder->expects($this->at(2))->method('addAttribute')->with('name', 'foo[]');
     $mockTagBuilder->expects($this->at(3))->method('addAttribute')->with('value', 2);
     $mockTagBuilder->expects($this->at(4))->method('addAttribute')->with('checked', 'checked');
     $object1 = new \stdClass();
     $object2 = new \stdClass();
     $object3 = new \stdClass();
     $this->viewHelper->expects($this->any())->method('getName')->willReturn('foo');
     $this->viewHelper->expects($this->any())->method('getValueAttribute')->willReturn(2);
     $this->viewHelper->expects($this->any())->method('isObjectAccessorMode')->willReturn(true);
     $this->viewHelper->expects($this->any())->method('getPropertyValue')->willReturn(array($object1, $object2, $object3));
     $this->viewHelper->_set('tag', $mockTagBuilder);
     $mockPersistenceManager = $this->getMock(PersistenceManagerInterface::class);
     $mockPersistenceManager->expects($this->any())->method('getIdentifierByObject')->will($this->returnValueMap(array(array($object1, 1), array($object2, 2), array($object3, 3))));
     $this->viewHelper->_set('persistenceManager', $mockPersistenceManager);
     $this->viewHelper->initialize();
     $this->viewHelper->render();
 }