123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- <?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) {
- $result = \OC\Share\Helper::calculateExpireDate($defaultExpireSettings, $creationTime, $userExpireDate);
- $this->assertSame($expected, $result);
- }
-
- public function testIsSameUserOnSameServer($user1, $server1, $user2, $server2, $expected) {
- $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],
- ];
- }
- }
|