Esempio n. 1
0
 /**
  * @test
  */
 public function updatePropertiesLeavesPropertiesUntouchedIfNotSetInNewProperties()
 {
     $fixture = new \TYPO3\CMS\Core\Resource\File(array('uid' => 1, 'foo' => 'asdf', 'identifier' => '/test'), $this->storageMock);
     $fixture->updateProperties(array('foo' => 'foobar'));
     $this->assertEquals('/test', $fixture->getIdentifier());
     $this->assertEquals('/test', $fixture->getProperty('identifier'));
 }
Esempio n. 2
0
 /**
  * @test
  */
 public function fileIsAutomaticallyIndexedOnPropertyAccessIfNotAlreadyIndexed()
 {
     $fixture = new \TYPO3\CMS\Core\Resource\File(array('identifier' => '/test', 'storage' => 1));
     $mockedRepository = $this->getMock('TYPO3\\CMS\\Core\\Resource\\FileRepository');
     $mockedRepository->expects($this->once())->method('getFileIndexRecord')->will($this->returnValue(FALSE));
     $mockedRepository->expects($this->once())->method('addToIndex')->will($this->returnValue(array('uid' => 10)));
     \TYPO3\CMS\Core\Utility\GeneralUtility::setSingletonInstance('TYPO3\\CMS\\Core\\Resource\\FileRepository', $mockedRepository);
     $this->assertEquals(10, $fixture->getProperty('uid'));
 }