Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Tests/Package/Activity/WatchingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

use Joomla\Github\Package\Activity\Watching;
use Joomla\Github\Tests\Stub\GitHubTestCase;
use PHPUnit\Framework\Attributes\IgnoreDeprecations;

/**
* Test class for the GitHub API package.
Expand Down Expand Up @@ -165,8 +166,11 @@ public function testDeleteSubscription()
*
* @return void
*/
#[IgnoreDeprecations]
public function testCheck()
{
$this->expectUserDeprecationMessageMatches('/' . preg_quote('Joomla\Github\Package\Activity\Watching::check() is deprecated and will be removed in 5.0', '/') . '/');

$this->response = $this->getResponseObject('', 204);

$this->client->expects($this->once())
Expand Down Expand Up @@ -224,8 +228,11 @@ public function testCheckUnexpected()
*
* @return void
*/
#[IgnoreDeprecations]
public function testWatch()
{
$this->expectUserDeprecationMessageMatches('/' . preg_quote('Joomla\Github\Package\Activity\Watching::watch() is deprecated and will be removed in 5.0', '/') . '/');

$this->response = $this->getResponseObject('', 204);

$this->client->expects($this->once())
Expand All @@ -246,8 +253,11 @@ public function testWatch()
*
* @return void
*/
#[IgnoreDeprecations]
public function testUnwatch()
{
$this->expectUserDeprecationMessageMatches('/' . preg_quote('Joomla\Github\Package\Activity\Watching::unwatch() is deprecated and will be removed in 5.0', '/') . '/');

$this->response = $this->getResponseObject('', 204);

$this->client->expects($this->once())
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"php": "^8.3.0",
"joomla/http": "^4.0",
"joomla/registry": "^4.0",
"joomla/uri": "^4.0"
"joomla/uri": "^4.0",
"symfony/deprecation-contracts": "^2|^3"
},
"require-dev": {
"phpunit/phpunit": "^12.2.7",
Expand Down
6 changes: 6 additions & 0 deletions docs/overview.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Github API package

TODO

## Watching repositories

`$github->activity->watching->getSubscription()`, `setSubscription()` and `deleteSubscription()` manage the
subscription to a repository. `check()`, `watch()` and `unwatch()` use the legacy `/user/subscriptions` routes; they
are deprecated and will be removed in 5.0.
24 changes: 24 additions & 0 deletions src/Package/Activity/Watching.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,17 @@ public function deleteSubscription($owner, $repo)
*
* @since 1.0
* @throws \UnexpectedValueException
* @deprecated 5.0 GitHub has replaced the legacy /user/subscriptions routes. Use getSubscription() instead.
*/
public function check($owner, $repo)
{
trigger_deprecation(
'joomla/github',
'__DEPLOY_VERSION__',
'%s() is deprecated and will be removed in 5.0, use getSubscription() instead.',
__METHOD__
);

// Build the request path.
$path = '/user/subscriptions/' . $owner . '/' . $repo;

Expand Down Expand Up @@ -175,9 +183,17 @@ public function check($owner, $repo)
* @return object
*
* @since 1.0
* @deprecated 5.0 GitHub has replaced the legacy /user/subscriptions routes. Use setSubscription() instead.
*/
public function watch($owner, $repo)
{
trigger_deprecation(
'joomla/github',
'__DEPLOY_VERSION__',
'%s() is deprecated and will be removed in 5.0, use setSubscription() instead.',
__METHOD__
);

// Build the request path.
$path = '/user/subscriptions/' . $owner . '/' . $repo;

Expand All @@ -198,9 +214,17 @@ public function watch($owner, $repo)
* @return object
*
* @since 1.0
* @deprecated 5.0 GitHub has replaced the legacy /user/subscriptions routes. Use deleteSubscription() instead.
*/
public function unwatch($owner, $repo)
{
trigger_deprecation(
'joomla/github',
'__DEPLOY_VERSION__',
'%s() is deprecated and will be removed in 5.0, use deleteSubscription() instead.',
__METHOD__
);

// Build the request path.
$path = '/user/subscriptions/' . $owner . '/' . $repo;

Expand Down
Loading