12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- <?php
- namespace Test\Share;
- class HelperTest extends \Test\TestCase {
- public function expireDateProvider() {
- return [
-
- [['defaultExpireDateSet' => false], 2000000000, 2000010000, 2000010000],
-
- [['defaultExpireDateSet' => false], 2000000000, null, false],
-
- [['defaultExpireDateSet' => true, 'expireAfterDays' => 1, 'enforceExpireDate' => false], 2000000000, null, false],
-
- [['defaultExpireDateSet' => true, 'expireAfterDays' => 1, 'enforceExpireDate' => true], 2000000000, null, 2000086400],
-
- [['defaultExpireDateSet' => true, 'expireAfterDays' => 1, 'enforceExpireDate' => false], 2000000000, 2000100000, 2000100000],
-
- [['defaultExpireDateSet' => true, 'expireAfterDays' => 1, 'enforceExpireDate' => false], 2000000000, 2000010000, 2000010000],
-
- [['defaultExpireDateSet' => true, 'expireAfterDays' => 1, 'enforceExpireDate' => true], 2000000000, 2000010000, 2000010000],
-
- [['defaultExpireDateSet' => true, 'expireAfterDays' => 1, 'enforceExpireDate' => true], 2000000000, 2000100000, 2000086400],
- ];
- }
-
- public function testCalculateExpireDate($defaultExpireSettings, $creationTime, $userExpireDate, $expected): void {
- $result = \OC\Share\Helper::calculateExpireDate($defaultExpireSettings, $creationTime, $userExpireDate);
- $this->assertSame($expected, $result);
- }
-
- public function testIsSameUserOnSameServer($user1, $server1, $user2, $server2, $expected): void {
- $this->assertSame($expected,
- \OC\Share\Helper::isSameUserOnSameServer($user1, $server1, $user2, $server2)
- );
- }
- public function dataTestCompareServerAddresses() {
- return [
- ['user1', 'http://server1', 'user1', 'http://server1', true],
- ['user1', 'https://server1', 'user1', 'http://server1', true],
- ['user1', 'http://serVer1', 'user1', 'http://server1', true],
- ['user1', 'http://server1/', 'user1', 'http://server1', true],
- ['user1', 'server1', 'user1', 'http://server1', true],
- ['user1', 'http://server1', 'user1', 'http://server2', false],
- ['user1', 'https://server1', 'user1', 'http://server2', false],
- ['user1', 'http://serVer1', 'user1', 'http://serer2', false],
- ['user1', 'http://server1/', 'user1', 'http://server2', false],
- ['user1', 'server1', 'user1', 'http://server2', false],
- ['user1', 'http://server1', 'user2', 'http://server1', false],
- ['user1', 'https://server1', 'user2', 'http://server1', false],
- ['user1', 'http://serVer1', 'user2', 'http://server1', false],
- ['user1', 'http://server1/', 'user2', 'http://server1', false],
- ['user1', 'server1', 'user2', 'http://server1', false],
- ];
- }
- }
|