TYPO3 CMS  TYPO3_7-6
LockFactoryTest.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
23 
28 {
32  protected $mockFactory;
33 
37  protected function setUp()
38  {
39  $this->mockFactory = $this->getAccessibleMock(LockFactory::class, ['dummy']);
40  }
41 
46  {
47  $this->mockFactory->addLockingStrategy(DummyLock::class);
48  $this->assertArrayHasKey(DummyLock::class, $this->mockFactory->_get('lockingStrategy'));
49  }
50 
57  {
58  $this->mockFactory->addLockingStrategy(\stdClass::class);
59  }
60 
65  {
66  $this->mockFactory->_set('lockingStrategy', [FileLockStrategy::class => true, DummyLock::class => true]);
68  $this->assertInstanceOf(FileLockStrategy::class, $locker);
69  }
70 
75  {
76  $this->mockFactory->_set('lockingStrategy', [SemaphoreLockStrategy::class => true, DummyLock::class => true]);
77  $locker = $this->mockFactory->createLocker('id');
78  $this->assertInstanceOf(DummyLock::class, $locker);
79  }
80 
86  {
87  $this->mockFactory->createLocker('id', 32);
88  }
89 }
getAccessibleMock( $originalClassName, $methods=[], array $arguments=[], $mockClassName='', $callOriginalConstructor=true, $callOriginalClone=true, $callAutoload=true)