Skip to content

Commit

Permalink
fix: phpunit deprecation on abstract test classes
Browse files Browse the repository at this point in the history
  • Loading branch information
DeepDiver1975 committed Nov 9, 2023
1 parent a562b99 commit 02668f8
Show file tree
Hide file tree
Showing 121 changed files with 255 additions and 230 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

namespace Sabre;

use PHPUnit\Framework\TestCase;
use Sabre\CalDAV\SharingPlugin;
use Sabre\DAV\Server;
use Sabre\DAV\Sharing\Plugin;
use Sabre\HTTP\Request;
use Sabre\HTTP\Response;

Expand All @@ -17,7 +21,7 @@
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
abstract class DAVServerTest extends \PHPUnit\Framework\TestCase
abstract class AbstractDAVServerTestCase extends TestCase
{
protected $setupCalDAV = false;
protected $setupCardDAV = false;
Expand All @@ -43,7 +47,7 @@ abstract class DAVServerTest extends \PHPUnit\Framework\TestCase
protected $carddavCards = [];

/**
* @var \Sabre\DAV\Server
* @var Server
*/
protected $server;
protected $tree = [];
Expand All @@ -70,7 +74,7 @@ abstract class DAVServerTest extends \PHPUnit\Framework\TestCase
protected $aclPlugin;

/**
* @var \Sabre\CalDAV\SharingPlugin
* @var SharingPlugin
*/
protected $caldavSharingPlugin;

Expand Down Expand Up @@ -99,7 +103,7 @@ abstract class DAVServerTest extends \PHPUnit\Framework\TestCase
/**
* Sharing plugin.
*
* @var \Sabre\DAV\Sharing\Plugin
* @var Plugin
*/
protected $sharingPlugin;

Expand Down Expand Up @@ -190,10 +194,10 @@ public function initializeEverything()
* the returned response. If it doesn't match, we'll immediately fail
* the test.
*
* @param array|\Sabre\HTTP\Request $request
* @param int $expectedStatus
* @param array|Request $request
* @param int $expectedStatus
*
* @return \Sabre\HTTP\Response
* @return Response
*/
public function request($request, $expectedStatus = null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@

namespace Sabre\CalDAV\Backend;

use DateTime;
use PHPUnit\Framework\TestCase;
use Sabre\CalDAV;
use Sabre\DAV;
use Sabre\DAV\PropPatch;
use Sabre\DAV\Sharing\Plugin;
use Sabre\DAV\Xml\Element\Sharee;
use Sabre\DAV\Xml\Property\Href;

abstract class AbstractPDOTest extends \PHPUnit\Framework\TestCase
abstract class AbstractPDOTestCase extends TestCase
{
use DAV\DbTestHelperTrait;

Expand Down Expand Up @@ -64,7 +68,7 @@ public function testCreateCalendarAndFetch()
'{DAV:}displayname' => 'Hello!',
'{urn:ietf:params:xml:ns:caldav}calendar-description' => '',
'{urn:ietf:params:xml:ns:caldav}schedule-calendar-transp' => new CalDAV\Xml\Property\ScheduleCalendarTransp('transparent'),
'share-access' => \Sabre\DAV\Sharing\Plugin::ACCESS_SHAREDOWNER,
'share-access' => Plugin::ACCESS_SHAREDOWNER,
];

self::assertIsArray($calendars);
Expand Down Expand Up @@ -765,8 +769,8 @@ public function testCalendarQueryTimeRange()
'prop-filters' => [],
'is-not-defined' => false,
'time-range' => [
'start' => new \DateTime('20120103'),
'end' => new \DateTime('20120104'),
'start' => new DateTime('20120103'),
'end' => new DateTime('20120104'),
],
],
],
Expand Down Expand Up @@ -796,7 +800,7 @@ public function testCalendarQueryTimeRangeEndNull()
'prop-filters' => [],
'is-not-defined' => false,
'time-range' => [
'start' => new \DateTime('20120102'),
'start' => new DateTime('20120102'),
'end' => null,
],
],
Expand Down Expand Up @@ -827,7 +831,7 @@ public function testCalendarQueryTimeRangeNoEnd()
'prop-filters' => [],
'is-not-defined' => false,
'time-range' => [
'start' => new \DateTime('20120102'),
'start' => new DateTime('20120102'),
],
],
],
Expand Down Expand Up @@ -857,7 +861,7 @@ public function testCalendarQueryTimeRangeNoStart()
'prop-filters' => [],
'is-not-defined' => false,
'time-range' => [
'end' => new \DateTime('20120102'),
'end' => new DateTime('20120102'),
],
],
],
Expand Down Expand Up @@ -991,7 +995,7 @@ public function testGetChangesBadId()
public function testCreateSubscriptions()
{
$props = [
'{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Xml\Property\Href('http://example.org/cal.ics'),
'{http://calendarserver.org/ns/}source' => new Href('http://example.org/cal.ics'),
'{DAV:}displayname' => 'cal',
'{http://apple.com/ns/ical/}refreshrate' => 'P1W',
'{http://apple.com/ns/ical/}calendar-color' => '#FF00FFFF',
Expand Down Expand Up @@ -1032,7 +1036,7 @@ public function testCreateSubscriptionFail()
public function testUpdateSubscriptions()
{
$props = [
'{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Xml\Property\Href('http://example.org/cal.ics'),
'{http://calendarserver.org/ns/}source' => new Href('http://example.org/cal.ics'),
'{DAV:}displayname' => 'cal',
'{http://apple.com/ns/ical/}refreshrate' => 'P1W',
'{http://apple.com/ns/ical/}calendar-color' => '#FF00FFFF',
Expand All @@ -1046,7 +1050,7 @@ public function testUpdateSubscriptions()

$newProps = [
'{DAV:}displayname' => 'new displayname',
'{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Xml\Property\Href('http://example.org/cal2.ics'),
'{http://calendarserver.org/ns/}source' => new Href('http://example.org/cal2.ics'),
];

$propPatch = new DAV\PropPatch($newProps);
Expand Down Expand Up @@ -1074,7 +1078,7 @@ public function testUpdateSubscriptions()
public function testUpdateSubscriptionsFail()
{
$props = [
'{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Xml\Property\Href('http://example.org/cal.ics'),
'{http://calendarserver.org/ns/}source' => new Href('http://example.org/cal.ics'),
'{DAV:}displayname' => 'cal',
'{http://apple.com/ns/ical/}refreshrate' => 'P1W',
'{http://apple.com/ns/ical/}calendar-color' => '#FF00FFFF',
Expand All @@ -1088,7 +1092,7 @@ public function testUpdateSubscriptionsFail()

$propPatch = new DAV\PropPatch([
'{DAV:}displayname' => 'new displayname',
'{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Xml\Property\Href('http://example.org/cal2.ics'),
'{http://calendarserver.org/ns/}source' => new Href('http://example.org/cal2.ics'),
'{DAV:}unknown' => 'foo',
]);

Expand All @@ -1105,7 +1109,7 @@ public function testUpdateSubscriptionsFail()
public function testDeleteSubscriptions()
{
$props = [
'{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Xml\Property\Href('http://example.org/cal.ics'),
'{http://calendarserver.org/ns/}source' => new Href('http://example.org/cal.ics'),
'{DAV:}displayname' => 'cal',
'{http://apple.com/ns/ical/}refreshrate' => 'P1W',
'{http://apple.com/ns/ical/}calendar-color' => '#FF00FFFF',
Expand All @@ -1119,7 +1123,7 @@ public function testDeleteSubscriptions()

$newProps = [
'{DAV:}displayname' => 'new displayname',
'{http://calendarserver.org/ns/}source' => new \Sabre\DAV\Xml\Property\Href('http://example.org/cal2.ics'),
'{http://calendarserver.org/ns/}source' => new Href('http://example.org/cal2.ics'),
];

$backend->deleteSubscription(1);
Expand Down Expand Up @@ -1213,8 +1217,8 @@ public function testGetInvites()
new Sharee([
'href' => 'principals/user1',
'principal' => 'principals/user1',
'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_SHAREDOWNER,
'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED,
'access' => Plugin::ACCESS_SHAREDOWNER,
'inviteStatus' => Plugin::INVITE_ACCEPTED,
]),
];

Expand Down Expand Up @@ -1250,8 +1254,8 @@ public function testUpdateInvites()
$ownerSharee = new Sharee([
'href' => 'principals/user1',
'principal' => 'principals/user1',
'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_SHAREDOWNER,
'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED,
'access' => Plugin::ACCESS_SHAREDOWNER,
'inviteStatus' => Plugin::INVITE_ACCEPTED,
]);

// Add a new invite
Expand All @@ -1261,8 +1265,8 @@ public function testUpdateInvites()
new Sharee([
'href' => 'mailto:[email protected]',
'principal' => 'principals/user2',
'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READ,
'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED,
'access' => Plugin::ACCESS_READ,
'inviteStatus' => Plugin::INVITE_ACCEPTED,
'properties' => ['{DAV:}displayname' => 'User 2'],
]),
]
Expand All @@ -1274,8 +1278,8 @@ public function testUpdateInvites()
new Sharee([
'href' => 'mailto:[email protected]',
'principal' => 'principals/user2',
'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READ,
'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED,
'access' => Plugin::ACCESS_READ,
'inviteStatus' => Plugin::INVITE_ACCEPTED,
'properties' => [
'{DAV:}displayname' => 'User 2',
],
Expand All @@ -1289,7 +1293,7 @@ public function testUpdateInvites()
'principaluri' => 'principals/user2',
'{http://calendarserver.org/ns/}getctag' => 'http://sabre.io/ns/sync/1',
'{http://sabredav.org/ns}sync-token' => '1',
'share-access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READ,
'share-access' => Plugin::ACCESS_READ,
'read-only' => true,
'share-resource-uri' => '/ns/share/1',
];
Expand All @@ -1310,8 +1314,8 @@ public function testUpdateInvites()
new Sharee([
'href' => 'mailto:[email protected]',
'principal' => 'principals/user2',
'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READWRITE,
'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED,
'access' => Plugin::ACCESS_READWRITE,
'inviteStatus' => Plugin::INVITE_ACCEPTED,
]),
]
);
Expand All @@ -1322,8 +1326,8 @@ public function testUpdateInvites()
new Sharee([
'href' => 'mailto:[email protected]',
'principal' => 'principals/user2',
'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READWRITE,
'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED,
'access' => Plugin::ACCESS_READWRITE,
'inviteStatus' => Plugin::INVITE_ACCEPTED,
'properties' => [
'{DAV:}displayname' => 'User 2',
],
Expand All @@ -1337,7 +1341,7 @@ public function testUpdateInvites()
[
new Sharee([
'href' => 'mailto:[email protected]',
'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_NOACCESS,
'access' => Plugin::ACCESS_NOACCESS,
]),
]
);
Expand All @@ -1354,7 +1358,7 @@ public function testUpdateInvites()
[
new Sharee([
'href' => 'principals/user2',
'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_NOACCESS,
'access' => Plugin::ACCESS_NOACCESS,
]),
]
);
Expand All @@ -1364,8 +1368,8 @@ public function testUpdateInvites()
new Sharee([
'href' => 'principals/user1',
'principal' => 'principals/user1',
'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_SHAREDOWNER,
'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED,
'access' => Plugin::ACCESS_SHAREDOWNER,
'inviteStatus' => Plugin::INVITE_ACCEPTED,
]),
];
self::assertEquals($expected, $result);
Expand Down Expand Up @@ -1399,8 +1403,8 @@ public function testUpdateInvitesNoPrincipal()
$ownerSharee = new Sharee([
'href' => 'principals/user1',
'principal' => 'principals/user1',
'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_SHAREDOWNER,
'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED,
'access' => Plugin::ACCESS_SHAREDOWNER,
'inviteStatus' => Plugin::INVITE_ACCEPTED,
]);

// Add a new invite
Expand All @@ -1410,8 +1414,8 @@ public function testUpdateInvitesNoPrincipal()
new Sharee([
'href' => 'mailto:[email protected]',
'principal' => null,
'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READ,
'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED,
'access' => Plugin::ACCESS_READ,
'inviteStatus' => Plugin::INVITE_ACCEPTED,
'properties' => ['{DAV:}displayname' => 'User 2'],
]),
]
Expand All @@ -1423,8 +1427,8 @@ public function testUpdateInvitesNoPrincipal()
new Sharee([
'href' => 'mailto:[email protected]',
'principal' => null,
'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READ,
'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_INVALID,
'access' => Plugin::ACCESS_READ,
'inviteStatus' => Plugin::INVITE_INVALID,
'properties' => [
'{DAV:}displayname' => 'User 2',
],
Expand All @@ -1447,8 +1451,8 @@ public function testDeleteSharedCalendar()
$ownerSharee = new Sharee([
'href' => 'principals/user1',
'principal' => 'principals/user1',
'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_SHAREDOWNER,
'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED,
'access' => Plugin::ACCESS_SHAREDOWNER,
'inviteStatus' => Plugin::INVITE_ACCEPTED,
]);

// Add a new invite
Expand All @@ -1458,8 +1462,8 @@ public function testDeleteSharedCalendar()
new Sharee([
'href' => 'mailto:[email protected]',
'principal' => 'principals/user2',
'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READ,
'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED,
'access' => Plugin::ACCESS_READ,
'inviteStatus' => Plugin::INVITE_ACCEPTED,
'properties' => ['{DAV:}displayname' => 'User 2'],
]),
]
Expand All @@ -1470,7 +1474,7 @@ public function testDeleteSharedCalendar()
'principaluri' => 'principals/user2',
'{http://calendarserver.org/ns/}getctag' => 'http://sabre.io/ns/sync/1',
'{http://sabredav.org/ns}sync-token' => '1',
'share-access' => \Sabre\DAV\Sharing\Plugin::ACCESS_READ,
'share-access' => Plugin::ACCESS_READ,
'read-only' => true,
'share-resource-uri' => '/ns/share/1',
];
Expand All @@ -1497,8 +1501,8 @@ public function testDeleteSharedCalendar()
new Sharee([
'href' => 'principals/user1',
'principal' => 'principals/user1',
'access' => \Sabre\DAV\Sharing\Plugin::ACCESS_SHAREDOWNER,
'inviteStatus' => \Sabre\DAV\Sharing\Plugin::INVITE_ACCEPTED,
'access' => Plugin::ACCESS_SHAREDOWNER,
'inviteStatus' => Plugin::INVITE_ACCEPTED,
]),
];
self::assertEquals($expected, $result);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Sabre\CalDAV\Backend;

class PDOMySQLTest extends AbstractPDOTest
class PDOMySQLTestCase extends AbstractPDOTestCase
{
public $driver = 'mysql';
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Sabre\CalDAV\Backend;

class PDOPgSqlTest extends AbstractPDOTest
class PDOPgSqlTestCase extends AbstractPDOTestCase
{
public $driver = 'pgsql';
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Sabre\CalDAV\Backend;

class PDOSqliteTest extends AbstractPDOTest
class PDOSqliteTestCase extends AbstractPDOTestCase
{
public $driver = 'sqlite';
}
Loading

0 comments on commit 02668f8

Please sign in to comment.