Pour vous faire mieux @@ -124,7 +124,7 @@ class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest { LONG_STRING; - protected function v($value) { + protected static function v($value) { return $value; } @@ -134,7 +134,7 @@ LONG_STRING; // create mock timestamps \Phake::when(Arsse::$obj)->get(\DateTimeImmutable::class)->thenReturn(new \DateTimeImmutable(self::NOW)); // create a mock user manager - $this->userId = "john.doe@example.com"; + self::$userId = "john.doe@example.com"; Arsse::$user = \Phake::mock(User::class); \Phake::when(Arsse::$user)->auth->thenReturn(true); // create a mock database interface @@ -145,13 +145,13 @@ LONG_STRING; 'id' => "PriestsOfSyrinx", 'created' => "2000-01-01 00:00:00", 'expires' => "2112-12-21 21:12:00", - 'user' => $this->userId, + 'user' => self::$userId, ]); $this->h = new API(); } protected function req($data, string $method = "POST", string $target = "", ?string $strData = null, ?string $user = null): ResponseInterface { - Arsse::$user->id = $this->userId; + Arsse::$user->id = self::$userId; $prefix = "/tt-rss/api"; $url = $prefix.$target; $body = $strData ?? json_encode($data); @@ -163,7 +163,7 @@ LONG_STRING; return $this->req($data, "POST", "", null, $user); } - protected function respGood($content = null, $seq = 0): ResponseInterface { + protected static function respGood($content = null, $seq = 0): ResponseInterface { return HTTP::respJson([ 'seq' => $seq, 'status' => 0, @@ -171,7 +171,7 @@ LONG_STRING; ]); } - protected function respErr(string $msg, $content = [], $seq = 0): ResponseInterface { + protected static function respErr(string $msg, $content = [], $seq = 0): ResponseInterface { $err = ['error' => $msg]; return HTTP::respJson([ 'seq' => $seq, @@ -181,7 +181,7 @@ LONG_STRING; } public function testHandleInvalidPaths(): void { - $exp = $this->respErr("MALFORMED_INPUT", [], null); + $exp = self::respErr("MALFORMED_INPUT", [], null); $this->assertMessage($exp, $this->req(null, "POST", "", "")); $this->assertMessage($exp, $this->req(null, "POST", "/", "")); $this->assertMessage($exp, $this->req(null, "POST", "/index.php", "")); @@ -198,14 +198,14 @@ LONG_STRING; } public function testHandleInvalidData(): void { - $exp = $this->respErr("MALFORMED_INPUT", [], null); + $exp = self::respErr("MALFORMED_INPUT", [], null); $this->assertMessage($exp, $this->req(null, "POST", "", "This is not valid JSON data")); $this->assertMessage($exp, $this->req(null, "POST", "", "")); // lack of data is also an error } /** @dataProvider provideLoginRequests */ public function testLogIn(array $conf, $httpUser, array $data, $sessions): void { - $this->userId = null; + self::$userId = null; self::setConf($conf); \Phake::when(Arsse::$user)->auth->thenReturn(false); \Phake::when(Arsse::$user)->auth("john.doe@example.com", "secret")->thenReturn(true); @@ -216,11 +216,11 @@ LONG_STRING; $exp1 = $sessions; $exp2 = $sessions; } elseif ($sessions) { - $exp1 = $this->respGood(['session_id' => $sessions[0], 'api_level' => \JKingWeb\Arsse\REST\TinyTinyRSS\API::LEVEL]); - $exp2 = $this->respGood(['session_id' => $sessions[1], 'api_level' => \JKingWeb\Arsse\REST\TinyTinyRSS\API::LEVEL]); + $exp1 = self::respGood(['session_id' => $sessions[0], 'api_level' => \JKingWeb\Arsse\REST\TinyTinyRSS\API::LEVEL]); + $exp2 = self::respGood(['session_id' => $sessions[1], 'api_level' => \JKingWeb\Arsse\REST\TinyTinyRSS\API::LEVEL]); } else { - $exp1 = $this->respErr("LOGIN_ERROR"); - $exp2 = $this->respErr("LOGIN_ERROR"); + $exp1 = self::respErr("LOGIN_ERROR"); + $exp2 = self::respErr("LOGIN_ERROR"); } $data['op'] = "login"; $this->assertMessage($exp1, $this->reqAuth($data, $httpUser)); @@ -233,13 +233,13 @@ LONG_STRING; \Phake::verify(Arsse::$db, \Phake::never())->sessionResume(\Phake::anyParameters()); } - public function provideLoginRequests(): iterable { - return $this->generateLoginRequests("login"); + public static function provideLoginRequests(): iterable { + return self::generateLoginRequests("login"); } /** @dataProvider provideResumeRequests */ public function testValidateASession(array $conf, $httpUser, string $data, $result): void { - $this->userId = null; + self::$userId = null; self::setConf($conf); \Phake::when(Arsse::$db)->sessionResume("PriestsOfSyrinx")->thenReturn([ 'id' => "PriestsOfSyrinx", @@ -261,21 +261,21 @@ LONG_STRING; $exp1 = $result; $exp2 = null; } elseif ($result) { - $exp1 = $this->respGood(['status' => true]); + $exp1 = self::respGood(['status' => true]); $exp2 = $result; } else { - $exp1 = $this->respErr("NOT_LOGGED_IN"); + $exp1 = self::respErr("NOT_LOGGED_IN"); $exp2 = ($httpUser) ? $httpUser : null; } $this->assertMessage($exp1, $this->reqAuth($data, $httpUser)); $this->assertSame($exp2, Arsse::$user->id); } - public function provideResumeRequests(): iterable { - return $this->generateLoginRequests("isLoggedIn"); + public static function provideResumeRequests(): iterable { + return self::generateLoginRequests("isLoggedIn"); } - public function generateLoginRequests(string $type): array { + public static function generateLoginRequests(string $type): array { $john = "john.doe@example.com"; $johnGood = [ 'user' => $john, @@ -526,7 +526,7 @@ LONG_STRING; \Phake::when(Arsse::$user)->auth->thenThrow(new \JKingWeb\Arsse\Db\ExceptionTimeout("general")); $data = [ 'op' => "login", - 'user' => $this->userId, + 'user' => self::$userId, 'password' => "secret", ]; $exp = HTTP::respEmpty(500); @@ -539,13 +539,13 @@ LONG_STRING; 'op' => "logout", 'sid' => "PriestsOfSyrinx", ]; - $exp = $this->respGood(['status' => "OK"]); + $exp = self::respGood(['status' => "OK"]); $this->assertMessage($exp, $this->req($data)); - \Phake::verify(Arsse::$db)->sessionDestroy($this->userId, "PriestsOfSyrinx"); + \Phake::verify(Arsse::$db)->sessionDestroy(self::$userId, "PriestsOfSyrinx"); } public function testHandleUnknownMethods(): void { - $exp = $this->respErr("UNKNOWN_METHOD", ['method' => "thisMethodDoesNotExist"]); + $exp = self::respErr("UNKNOWN_METHOD", ['method' => "thisMethodDoesNotExist"]); $data = [ 'op' => "thisMethodDoesNotExist", 'sid' => "PriestsOfSyrinx", @@ -558,7 +558,7 @@ LONG_STRING; 'op' => "isLoggedIn", 'sid' => "PriestsOfSyrinx", ]; - $exp = $this->respGood(['status' => true]); + $exp = self::respGood(['status' => true]); $this->assertMessage($exp, $this->req($data)); $data['op'] = "isloggedin"; $this->assertMessage($exp, $this->req($data)); @@ -573,7 +573,7 @@ LONG_STRING; 'op' => "getVersion", 'sid' => "PriestsOfSyrinx", ]; - $exp = $this->respGood([ + $exp = self::respGood([ 'version' => \JKingWeb\Arsse\REST\TinyTinyRSS\API::VERSION, 'arsse_version' => Arsse::VERSION, ]); @@ -585,7 +585,7 @@ LONG_STRING; 'op' => "getApiLevel", 'sid' => "PriestsOfSyrinx", ]; - $exp = $this->respGood(['level' => \JKingWeb\Arsse\REST\TinyTinyRSS\API::LEVEL]); + $exp = self::respGood(['level' => \JKingWeb\Arsse\REST\TinyTinyRSS\API::LEVEL]); $this->assertMessage($exp, $this->req($data)); } @@ -594,30 +594,30 @@ LONG_STRING; $in = array_merge(['op' => "addCategory", 'sid' => "PriestsOfSyrinx"], $in); $action = ($out instanceof \Exception) ? "thenThrow" : "thenReturn"; \Phake::when(Arsse::$db)->folderAdd->$action($out); - \Phake::when(Arsse::$db)->folderList($this->anything(), null, false)->thenReturn(new Result($this->v([ + \Phake::when(Arsse::$db)->folderList($this->anything(), null, false)->thenReturn(new Result(self::v([ ['id' => 2, 'name' => "Software", 'parent' => null], ['id' => 1, 'name' => "Politics", 'parent' => null], ]))); - \Phake::when(Arsse::$db)->folderList($this->anything(), 1, false)->thenReturn(new Result($this->v([ + \Phake::when(Arsse::$db)->folderList($this->anything(), 1, false)->thenReturn(new Result(self::v([ ['id' => 3, 'name' => "Hardware", 'parent' => 1], ]))); $this->assertMessage($exp, $this->req($in)); - \Phake::verify(Arsse::$db)->folderAdd($this->userId, $data); + \Phake::verify(Arsse::$db)->folderAdd(self::$userId, $data); if (!$out instanceof \Exception) { \Phake::verify(Arsse::$db, \Phake::never())->folderList(\Phake::anyParameters()); } } - public function provideCategoryAdditions(): iterable { + public static function provideCategoryAdditions(): iterable { return [ - [[], ['name' => null, 'parent' => null], new ExceptionInput("missing"), $this->respErr("INCORRECT_USAGE")], - [['caption' => ""], ['name' => "", 'parent' => null], new ExceptionInput("missing"), $this->respErr("INCORRECT_USAGE")], - [['caption' => " "], ['name' => " ", 'parent' => null], new ExceptionInput("whitespace"), $this->respErr("INCORRECT_USAGE")], - [['caption' => "Software"], ['name' => "Software", 'parent' => null], 2, $this->respGood("2")], - [['caption' => "Hardware", 'parent_id' => 1], ['name' => "Hardware", 'parent' => 1], 3, $this->respGood("3")], - [['caption' => "Hardware", 'parent_id' => 2112], ['name' => "Hardware", 'parent' => 2112], new ExceptionInput("idMissing"), $this->respGood(false)], - [['caption' => "Software"], ['name' => "Software", 'parent' => null], new ExceptionInput("constraintViolation"), $this->respGood("2")], - [['caption' => "Hardware", 'parent_id' => 1], ['name' => "Hardware", 'parent' => 1], new ExceptionInput("constraintViolation"), $this->respGood("3")], + [[], ['name' => null, 'parent' => null], new ExceptionInput("missing"), self::respErr("INCORRECT_USAGE")], + [['caption' => ""], ['name' => "", 'parent' => null], new ExceptionInput("missing"), self::respErr("INCORRECT_USAGE")], + [['caption' => " "], ['name' => " ", 'parent' => null], new ExceptionInput("whitespace"), self::respErr("INCORRECT_USAGE")], + [['caption' => "Software"], ['name' => "Software", 'parent' => null], 2, self::respGood("2")], + [['caption' => "Hardware", 'parent_id' => 1], ['name' => "Hardware", 'parent' => 1], 3, self::respGood("3")], + [['caption' => "Hardware", 'parent_id' => 2112], ['name' => "Hardware", 'parent' => 2112], new ExceptionInput("idMissing"), self::respGood(false)], + [['caption' => "Software"], ['name' => "Software", 'parent' => null], new ExceptionInput("constraintViolation"), self::respGood("2")], + [['caption' => "Hardware", 'parent_id' => 1], ['name' => "Hardware", 'parent' => 1], new ExceptionInput("constraintViolation"), self::respGood("3")], ]; } @@ -628,16 +628,16 @@ LONG_STRING; \Phake::when(Arsse::$db)->folderRemove->$action($out); $this->assertMessage($exp, $this->req($in)); if ($data > 0) { - \Phake::verify(Arsse::$db)->folderRemove($this->userId, (int) $data); + \Phake::verify(Arsse::$db)->folderRemove(self::$userId, (int) $data); } } - public function provideCategoryRemovals(): iterable { + public static function provideCategoryRemovals(): iterable { return [ - [['category_id' => 42], 42, true, $this->respGood()], - [['category_id' => 2112], 2112, new ExceptionInput("subjectMissing"), $this->respGood()], - [[], null, null, $this->respErr("INCORRECT_USAGE")], - [['category_id' => -1], null, null, $this->respErr("INCORRECT_USAGE")], + [['category_id' => 42], 42, true, self::respGood()], + [['category_id' => 2112], 2112, new ExceptionInput("subjectMissing"), self::respGood()], + [[], null, null, self::respErr("INCORRECT_USAGE")], + [['category_id' => -1], null, null, self::respErr("INCORRECT_USAGE")], ]; } @@ -654,17 +654,17 @@ LONG_STRING; } } - public function provideCategoryMoves(): iterable { + public static function provideCategoryMoves(): iterable { return [ - [['category_id' => 42, 'parent_id' => 1], [$this->userId, 42, ['parent' => 1]], true, $this->respGood()], - [['category_id' => 2112, 'parent_id' => 2], [$this->userId, 2112, ['parent' => 2]], new ExceptionInput("subjectMissing"), $this->respGood()], - [['category_id' => 42, 'parent_id' => 0], [$this->userId, 42, ['parent' => 0]], new ExceptionInput("constraintViolation"), $this->respGood()], - [['category_id' => 42, 'parent_id' => 47], [$this->userId, 42, ['parent' => 47]], new ExceptionInput("idMissing"), $this->respGood()], - [['category_id' => -1, 'parent_id' => 1], [$this->userId, -1, ['parent' => 1]], null, $this->respErr("INCORRECT_USAGE")], - [['category_id' => 42, 'parent_id' => -1], [$this->userId, 42, ['parent' => -1]], null, $this->respErr("INCORRECT_USAGE")], - [['category_id' => 42], [$this->userId, 42, ['parent' => 0]], new ExceptionInput("constraintViolation"), $this->respGood()], - [['parent_id' => -1], [$this->userId, 0, ['parent' => -1]], null, $this->respErr("INCORRECT_USAGE")], - [[], [$this->userId, 0, ['parent' => 0]], null, $this->respErr("INCORRECT_USAGE")], + [['category_id' => 42, 'parent_id' => 1], [self::$userId, 42, ['parent' => 1]], true, self::respGood()], + [['category_id' => 2112, 'parent_id' => 2], [self::$userId, 2112, ['parent' => 2]], new ExceptionInput("subjectMissing"), self::respGood()], + [['category_id' => 42, 'parent_id' => 0], [self::$userId, 42, ['parent' => 0]], new ExceptionInput("constraintViolation"), self::respGood()], + [['category_id' => 42, 'parent_id' => 47], [self::$userId, 42, ['parent' => 47]], new ExceptionInput("idMissing"), self::respGood()], + [['category_id' => -1, 'parent_id' => 1], [self::$userId, -1, ['parent' => 1]], null, self::respErr("INCORRECT_USAGE")], + [['category_id' => 42, 'parent_id' => -1], [self::$userId, 42, ['parent' => -1]], null, self::respErr("INCORRECT_USAGE")], + [['category_id' => 42], [self::$userId, 42, ['parent' => 0]], new ExceptionInput("constraintViolation"), self::respGood()], + [['parent_id' => -1], [self::$userId, 0, ['parent' => -1]], null, self::respErr("INCORRECT_USAGE")], + [[], [self::$userId, 0, ['parent' => 0]], null, self::respErr("INCORRECT_USAGE")], ]; } @@ -681,17 +681,17 @@ LONG_STRING; } } - public function provideCategoryRenamings(): iterable { + public static function provideCategoryRenamings(): iterable { return [ - [['category_id' => 42, 'caption' => "Ook"], [$this->userId, 42, ['name' => "Ook"]], true, $this->respGood()], - [['category_id' => 2112, 'caption' => "Eek"], [$this->userId, 2112, ['name' => "Eek"]], new ExceptionInput("subjectMissing"), $this->respGood()], - [['category_id' => 42, 'caption' => "Eek"], [$this->userId, 42, ['name' => "Eek"]], new ExceptionInput("constraintViolation"), $this->respGood()], - [['category_id' => 42, 'caption' => ""], null, null, $this->respErr("INCORRECT_USAGE")], - [['category_id' => 42, 'caption' => " "], null, null, $this->respErr("INCORRECT_USAGE")], - [['category_id' => -1, 'caption' => "Ook"], null, null, $this->respErr("INCORRECT_USAGE")], - [['category_id' => 42], null, null, $this->respErr("INCORRECT_USAGE")], - [['caption' => "Ook"], null, null, $this->respErr("INCORRECT_USAGE")], - [[], null, null, $this->respErr("INCORRECT_USAGE")], + [['category_id' => 42, 'caption' => "Ook"], [self::$userId, 42, ['name' => "Ook"]], true, self::respGood()], + [['category_id' => 2112, 'caption' => "Eek"], [self::$userId, 2112, ['name' => "Eek"]], new ExceptionInput("subjectMissing"), self::respGood()], + [['category_id' => 42, 'caption' => "Eek"], [self::$userId, 42, ['name' => "Eek"]], new ExceptionInput("constraintViolation"), self::respGood()], + [['category_id' => 42, 'caption' => ""], null, null, self::respErr("INCORRECT_USAGE")], + [['category_id' => 42, 'caption' => " "], null, null, self::respErr("INCORRECT_USAGE")], + [['category_id' => -1, 'caption' => "Ook"], null, null, self::respErr("INCORRECT_USAGE")], + [['category_id' => 42], null, null, self::respErr("INCORRECT_USAGE")], + [['caption' => "Ook"], null, null, self::respErr("INCORRECT_USAGE")], + [[], null, null, self::respErr("INCORRECT_USAGE")], ]; } @@ -706,37 +706,37 @@ LONG_STRING; ['id' => 4, 'url' => "http://example.com/9"], ]; \Phake::when(Arsse::$db)->subscriptionAdd->$action($out); - \Phake::when(Arsse::$db)->folderPropertiesGet($this->userId, 42)->thenReturn($this->v(['id' => 42])); - \Phake::when(Arsse::$db)->folderPropertiesGet($this->userId, 47)->thenReturn($this->v(['id' => 47])); - \Phake::when(Arsse::$db)->folderPropertiesGet($this->userId, 2112)->thenThrow(new ExceptionInput("subjectMissing")); - \Phake::when(Arsse::$db)->subscriptionPropertiesSet($this->userId, $this->anything())->thenReturn(true); - \Phake::when(Arsse::$db)->subscriptionPropertiesSet($this->userId, 4, $this->anything())->thenThrow(new ExceptionInput("idMissing")); - \Phake::when(Arsse::$db)->subscriptionList($this->userId)->thenReturn(new Result($this->v($list))); + \Phake::when(Arsse::$db)->folderPropertiesGet(self::$userId, 42)->thenReturn(self::v(['id' => 42])); + \Phake::when(Arsse::$db)->folderPropertiesGet(self::$userId, 47)->thenReturn(self::v(['id' => 47])); + \Phake::when(Arsse::$db)->folderPropertiesGet(self::$userId, 2112)->thenThrow(new ExceptionInput("subjectMissing")); + \Phake::when(Arsse::$db)->subscriptionPropertiesSet(self::$userId, $this->anything())->thenReturn(true); + \Phake::when(Arsse::$db)->subscriptionPropertiesSet(self::$userId, 4, $this->anything())->thenThrow(new ExceptionInput("idMissing")); + \Phake::when(Arsse::$db)->subscriptionList(self::$userId)->thenReturn(new Result(self::v($list))); $this->assertMessage($exp, $this->req($in)); if ($data !== null) { \Phake::verify(Arsse::$db)->subscriptionAdd(...$data); } else { \Phake::verify(Arsse::$db, \Phake::never())->subscriptionAdd(\Phake::anyParameters()); } - \Phake::verify(Arsse::$db, \Phake::never())->subscriptionPropertiesSet($this->userId, 4, ['folder' => 1]); + \Phake::verify(Arsse::$db, \Phake::never())->subscriptionPropertiesSet(self::$userId, 4, ['folder' => 1]); } - public function provideFeedSubscriptions(): iterable { + public static function provideFeedSubscriptions(): iterable { return [ - [['feed_url' => "http://example.com/0"], [$this->userId, "http://example.com/0", "", ""], 2, $this->respGood(['code' => 1, 'feed_id' => 2])], - [['feed_url' => "http://example.com/1", 'category_id' => 42], [$this->userId, "http://example.com/1", "", ""], new FeedException("unauthorized"), $this->respGood(['code' => 5, 'message' => (new FeedException("unauthorized"))->getMessage()])], - [['feed_url' => "http://example.com/2", 'category_id' => 2112], null, null, $this->respGood(['code' => 1, 'feed_id' => 0])], - [['feed_url' => "http://example.com/3"], [$this->userId, "http://example.com/3", "", ""], new ExceptionInput("constraintViolation"), $this->respGood(['code' => 0, 'feed_id' => 3])], - [['feed_url' => "http://localhost:8000/Feed/Discovery/Valid"], [$this->userId, "http://localhost:8000/Feed/Discovery/Valid", "", ""], new ExceptionInput("constraintViolation"), $this->respGood(['code' => 0, 'feed_id' => 1])], - [['feed_url' => "http://localhost:8000/Feed/Discovery/Invalid"], [$this->userId, "http://localhost:8000/Feed/Discovery/Invalid", "", ""], new ExceptionInput("constraintViolation"), $this->respGood(['code' => 3, 'message' => (new FeedException("subscriptionNotFound", ['url' => "http://localhost:8000/Feed/Discovery/Invalid"]))->getMessage()])], - [['feed_url' => "http://example.com/6"], [$this->userId, "http://example.com/6", "", ""], new FeedException("invalidUrl"), $this->respGood(['code' => 2, 'message' => (new FeedException("invalidUrl"))->getMessage()])], - [['feed_url' => "http://example.com/7"], [$this->userId, "http://example.com/7", "", ""], new FeedException("malformedXml"), $this->respGood(['code' => 6, 'message' => (new FeedException("malformedXml"))->getMessage()])], - [['feed_url' => "http://example.com/8", 'category_id' => 47], [$this->userId, "http://example.com/8", "", ""], 4, $this->respGood(['code' => 1, 'feed_id' => 4])], - [['feed_url' => "http://example.com/9", 'category_id' => 1], [$this->userId, "http://example.com/9", "", ""], new ExceptionInput("constraintViolation"), $this->respGood(['code' => 0, 'feed_id' => 4])], - [[], null, null, $this->respErr("INCORRECT_USAGE")], - [['feed_url' => "http://example.com/", 'login' => []], null, null, $this->respErr("INCORRECT_USAGE")], - [['feed_url' => "http://example.com/", 'login' => "", 'password' => []], null, null, $this->respErr("INCORRECT_USAGE")], - [['feed_url' => "http://example.com/", 'category_id' => -1], null, null, $this->respErr("INCORRECT_USAGE")], + [['feed_url' => "http://example.com/0"], [self::$userId, "http://example.com/0", "", ""], 2, self::respGood(['code' => 1, 'feed_id' => 2])], + [['feed_url' => "http://example.com/1", 'category_id' => 42], [self::$userId, "http://example.com/1", "", ""], new FeedException("unauthorized"), self::respGood(['code' => 5, 'message' => (new FeedException("unauthorized"))->getMessage()])], + [['feed_url' => "http://example.com/2", 'category_id' => 2112], null, null, self::respGood(['code' => 1, 'feed_id' => 0])], + [['feed_url' => "http://example.com/3"], [self::$userId, "http://example.com/3", "", ""], new ExceptionInput("constraintViolation"), self::respGood(['code' => 0, 'feed_id' => 3])], + [['feed_url' => "http://localhost:8000/Feed/Discovery/Valid"], [self::$userId, "http://localhost:8000/Feed/Discovery/Valid", "", ""], new ExceptionInput("constraintViolation"), self::respGood(['code' => 0, 'feed_id' => 1])], + [['feed_url' => "http://localhost:8000/Feed/Discovery/Invalid"], [self::$userId, "http://localhost:8000/Feed/Discovery/Invalid", "", ""], new ExceptionInput("constraintViolation"), self::respGood(['code' => 3, 'message' => (new FeedException("subscriptionNotFound", ['url' => "http://localhost:8000/Feed/Discovery/Invalid"]))->getMessage()])], + [['feed_url' => "http://example.com/6"], [self::$userId, "http://example.com/6", "", ""], new FeedException("invalidUrl"), self::respGood(['code' => 2, 'message' => (new FeedException("invalidUrl"))->getMessage()])], + [['feed_url' => "http://example.com/7"], [self::$userId, "http://example.com/7", "", ""], new FeedException("malformedXml"), self::respGood(['code' => 6, 'message' => (new FeedException("malformedXml"))->getMessage()])], + [['feed_url' => "http://example.com/8", 'category_id' => 47], [self::$userId, "http://example.com/8", "", ""], 4, self::respGood(['code' => 1, 'feed_id' => 4])], + [['feed_url' => "http://example.com/9", 'category_id' => 1], [self::$userId, "http://example.com/9", "", ""], new ExceptionInput("constraintViolation"), self::respGood(['code' => 0, 'feed_id' => 4])], + [[], null, null, self::respErr("INCORRECT_USAGE")], + [['feed_url' => "http://example.com/", 'login' => []], null, null, self::respErr("INCORRECT_USAGE")], + [['feed_url' => "http://example.com/", 'login' => "", 'password' => []], null, null, self::respErr("INCORRECT_USAGE")], + [['feed_url' => "http://example.com/", 'category_id' => -1], null, null, self::respErr("INCORRECT_USAGE")], ]; } @@ -753,12 +753,12 @@ LONG_STRING; } } - public function provideFeedUnsubscriptions(): iterable { + public static function provideFeedUnsubscriptions(): iterable { return [ - [['feed_id' => 42], [$this->userId, 42], true, $this->respGood(['status' => "OK"])], - [['feed_id' => 2112], [$this->userId, 2112], new ExceptionInput("subjectMissing"), $this->respErr("FEED_NOT_FOUND")], - [['feed_id' => -1], [$this->userId, -1], new ExceptionInput("typeViolation"), $this->respErr("FEED_NOT_FOUND")], - [[], [$this->userId, 0], new ExceptionInput("typeViolation"), $this->respErr("FEED_NOT_FOUND")], + [['feed_id' => 42], [self::$userId, 42], true, self::respGood(['status' => "OK"])], + [['feed_id' => 2112], [self::$userId, 2112], new ExceptionInput("subjectMissing"), self::respErr("FEED_NOT_FOUND")], + [['feed_id' => -1], [self::$userId, -1], new ExceptionInput("typeViolation"), self::respErr("FEED_NOT_FOUND")], + [[], [self::$userId, 0], new ExceptionInput("typeViolation"), self::respErr("FEED_NOT_FOUND")], ]; } @@ -775,17 +775,17 @@ LONG_STRING; } } - public function provideFeedMoves(): iterable { + public static function provideFeedMoves(): iterable { return [ - [['feed_id' => 42, 'category_id' => 1], [$this->userId, 42, ['folder' => 1]], true, $this->respGood()], - [['feed_id' => 2112, 'category_id' => 2], [$this->userId, 2112, ['folder' => 2]], new ExceptionInput("subjectMissing"), $this->respGood()], - [['feed_id' => 42, 'category_id' => 0], [$this->userId, 42, ['folder' => 0]], new ExceptionInput("constraintViolation"), $this->respGood()], - [['feed_id' => 42, 'category_id' => 47], [$this->userId, 42, ['folder' => 47]], new ExceptionInput("constraintViolation"), $this->respGood()], - [['feed_id' => -1, 'category_id' => 1], null, null, $this->respErr("INCORRECT_USAGE")], - [['feed_id' => 42, 'category_id' => -1], null, null, $this->respErr("INCORRECT_USAGE")], - [['feed_id' => 42], null, null, $this->respErr("INCORRECT_USAGE")], - [['category_id' => -1], null, null, $this->respErr("INCORRECT_USAGE")], - [[], null, null, $this->respErr("INCORRECT_USAGE")], + [['feed_id' => 42, 'category_id' => 1], [self::$userId, 42, ['folder' => 1]], true, self::respGood()], + [['feed_id' => 2112, 'category_id' => 2], [self::$userId, 2112, ['folder' => 2]], new ExceptionInput("subjectMissing"), self::respGood()], + [['feed_id' => 42, 'category_id' => 0], [self::$userId, 42, ['folder' => 0]], new ExceptionInput("constraintViolation"), self::respGood()], + [['feed_id' => 42, 'category_id' => 47], [self::$userId, 42, ['folder' => 47]], new ExceptionInput("constraintViolation"), self::respGood()], + [['feed_id' => -1, 'category_id' => 1], null, null, self::respErr("INCORRECT_USAGE")], + [['feed_id' => 42, 'category_id' => -1], null, null, self::respErr("INCORRECT_USAGE")], + [['feed_id' => 42], null, null, self::respErr("INCORRECT_USAGE")], + [['category_id' => -1], null, null, self::respErr("INCORRECT_USAGE")], + [[], null, null, self::respErr("INCORRECT_USAGE")], ]; } @@ -802,28 +802,28 @@ LONG_STRING; } } - public function provideFeedRenamings(): iterable { + public static function provideFeedRenamings(): iterable { return [ - [['feed_id' => 42, 'caption' => "Ook"], [$this->userId, 42, ['title' => "Ook"]], true, $this->respGood()], - [['feed_id' => 2112, 'caption' => "Eek"], [$this->userId, 2112, ['title' => "Eek"]], new ExceptionInput("subjectMissing"), $this->respGood()], - [['feed_id' => 42, 'caption' => "Eek"], [$this->userId, 42, ['title' => "Eek"]], new ExceptionInput("constraintViolation"), $this->respGood()], - [['feed_id' => 42, 'caption' => ""], null, null, $this->respErr("INCORRECT_USAGE")], - [['feed_id' => 42, 'caption' => " "], null, null, $this->respErr("INCORRECT_USAGE")], - [['feed_id' => -1, 'caption' => "Ook"], null, null, $this->respErr("INCORRECT_USAGE")], - [['feed_id' => 42], null, null, $this->respErr("INCORRECT_USAGE")], - [['caption' => "Ook"], null, null, $this->respErr("INCORRECT_USAGE")], - [[], null, null, $this->respErr("INCORRECT_USAGE")], + [['feed_id' => 42, 'caption' => "Ook"], [self::$userId, 42, ['title' => "Ook"]], true, self::respGood()], + [['feed_id' => 2112, 'caption' => "Eek"], [self::$userId, 2112, ['title' => "Eek"]], new ExceptionInput("subjectMissing"), self::respGood()], + [['feed_id' => 42, 'caption' => "Eek"], [self::$userId, 42, ['title' => "Eek"]], new ExceptionInput("constraintViolation"), self::respGood()], + [['feed_id' => 42, 'caption' => ""], null, null, self::respErr("INCORRECT_USAGE")], + [['feed_id' => 42, 'caption' => " "], null, null, self::respErr("INCORRECT_USAGE")], + [['feed_id' => -1, 'caption' => "Ook"], null, null, self::respErr("INCORRECT_USAGE")], + [['feed_id' => 42], null, null, self::respErr("INCORRECT_USAGE")], + [['caption' => "Ook"], null, null, self::respErr("INCORRECT_USAGE")], + [[], null, null, self::respErr("INCORRECT_USAGE")], ]; } public function testRetrieveTheGlobalUnreadCount(): void { $in = ['op' => "getUnread", 'sid' => "PriestsOfSyrinx"]; - \Phake::when(Arsse::$db)->subscriptionList->thenReturn(new Result($this->v([ + \Phake::when(Arsse::$db)->subscriptionList->thenReturn(new Result(self::v([ ['id' => 1, 'unread' => 2112], ['id' => 2, 'unread' => 42], ['id' => 3, 'unread' => 47], ]))); - $exp = $this->respGood(['unread' => (string) (2112 + 42 + 47)]); + $exp = self::respGood(['unread' => (string) (2112 + 42 + 47)]); $this->assertMessage($exp, $this->req($in)); } @@ -833,9 +833,9 @@ LONG_STRING; $valid = (new \DateTimeImmutable("now", new \DateTimezone("UTC")))->sub($interval); $invalid = $valid->sub($interval)->sub($interval); \Phake::when(Arsse::$db)->metaGet("service_last_checkin")->thenReturn(Date::transform($valid, "sql"))->thenReturn(Date::transform($invalid, "sql")); - \Phake::when(Arsse::$db)->subscriptionCount($this->userId)->thenReturn(12)->thenReturn(2); - $this->assertMessage($this->respGood(['icons_dir' => "feed-icons", 'icons_url' => "feed-icons", 'daemon_is_running' => true, 'num_feeds' => 12]), $this->req($in)); - $this->assertMessage($this->respGood(['icons_dir' => "feed-icons", 'icons_url' => "feed-icons", 'daemon_is_running' => false, 'num_feeds' => 2]), $this->req($in)); + \Phake::when(Arsse::$db)->subscriptionCount(self::$userId)->thenReturn(12)->thenReturn(2); + $this->assertMessage(self::respGood(['icons_dir' => "feed-icons", 'icons_url' => "feed-icons", 'daemon_is_running' => true, 'num_feeds' => 12]), $this->req($in)); + $this->assertMessage(self::respGood(['icons_dir' => "feed-icons", 'icons_url' => "feed-icons", 'daemon_is_running' => false, 'num_feeds' => 2]), $this->req($in)); } /** @dataProvider provideFeedUpdates */ @@ -857,12 +857,12 @@ LONG_STRING; } } - public function provideFeedUpdates(): iterable { + public static function provideFeedUpdates(): iterable { return [ - [['feed_id' => 1], [$this->userId, 1], $this->v(['id' => 1, 'feed' => 11]), 11, $this->respGood(['status' => "OK"])], - [['feed_id' => 2], [$this->userId, 2], new ExceptionInput("subjectMissing"), null, $this->respErr("FEED_NOT_FOUND")], - [['feed_id' => -1], null, null, null, $this->respErr("INCORRECT_USAGE")], - [[], null, null, null, $this->respErr("INCORRECT_USAGE")], + [['feed_id' => 1], [self::$userId, 1], self::v(['id' => 1, 'feed' => 11]), 11, self::respGood(['status' => "OK"])], + [['feed_id' => 2], [self::$userId, 2], new ExceptionInput("subjectMissing"), null, self::respErr("FEED_NOT_FOUND")], + [['feed_id' => -1], null, null, null, self::respErr("INCORRECT_USAGE")], + [[], null, null, null, self::respErr("INCORRECT_USAGE")], ]; } @@ -885,15 +885,15 @@ LONG_STRING; } } - public function provideLabelAdditions(): iterable { + public static function provideLabelAdditions(): iterable { return [ - [['caption' => "Software"], [$this->userId, ['name' => "Software"]], 2, null, null, $this->respGood(-1026)], - [['caption' => "Hardware"], [$this->userId, ['name' => "Hardware"]], 3, null, null, $this->respGood(-1027)], - [['caption' => "Software"], [$this->userId, ['name' => "Software"]], new ExceptionInput("constraintViolation"), [$this->userId, "Software", true], ['id' => 2], $this->respGood(-1026)], - [['caption' => "Hardware"], [$this->userId, ['name' => "Hardware"]], new ExceptionInput("constraintViolation"), [$this->userId, "Hardware", true], ['id' => 3], $this->respGood(-1027)], - [[], [$this->userId, ['name' => ""]], new ExceptionInput("typeViolation"), null, null, $this->respErr("INCORRECT_USAGE")], - [['caption' => ""], [$this->userId, ['name' => ""]], new ExceptionInput("typeViolation"), null, null, $this->respErr("INCORRECT_USAGE")], - [['caption' => " "], [$this->userId, ['name' => " "]], new ExceptionInput("typeViolation"), null, null, $this->respErr("INCORRECT_USAGE")], + [['caption' => "Software"], [self::$userId, ['name' => "Software"]], 2, null, null, self::respGood(-1026)], + [['caption' => "Hardware"], [self::$userId, ['name' => "Hardware"]], 3, null, null, self::respGood(-1027)], + [['caption' => "Software"], [self::$userId, ['name' => "Software"]], new ExceptionInput("constraintViolation"), [self::$userId, "Software", true], ['id' => 2], self::respGood(-1026)], + [['caption' => "Hardware"], [self::$userId, ['name' => "Hardware"]], new ExceptionInput("constraintViolation"), [self::$userId, "Hardware", true], ['id' => 3], self::respGood(-1027)], + [[], [self::$userId, ['name' => ""]], new ExceptionInput("typeViolation"), null, null, self::respErr("INCORRECT_USAGE")], + [['caption' => ""], [self::$userId, ['name' => ""]], new ExceptionInput("typeViolation"), null, null, self::respErr("INCORRECT_USAGE")], + [['caption' => " "], [self::$userId, ['name' => " "]], new ExceptionInput("typeViolation"), null, null, self::respErr("INCORRECT_USAGE")], ]; } @@ -910,14 +910,14 @@ LONG_STRING; } } - public function provideLabelRemovals(): iterable { + public static function provideLabelRemovals(): iterable { return [ - [['label_id' => -1042], [$this->userId, 18], true, $this->respGood()], - [['label_id' => -2112], [$this->userId, 1088], new ExceptionInput("subjectMissing"), $this->respGood()], - [['label_id' => 1], null, null, $this->respErr("INCORRECT_USAGE")], - [['label_id' => 0], null, null, $this->respErr("INCORRECT_USAGE")], - [['label_id' => -10], null, null, $this->respErr("INCORRECT_USAGE")], - [[], null, null, $this->respErr("INCORRECT_USAGE")], + [['label_id' => -1042], [self::$userId, 18], true, self::respGood()], + [['label_id' => -2112], [self::$userId, 1088], new ExceptionInput("subjectMissing"), self::respGood()], + [['label_id' => 1], null, null, self::respErr("INCORRECT_USAGE")], + [['label_id' => 0], null, null, self::respErr("INCORRECT_USAGE")], + [['label_id' => -10], null, null, self::respErr("INCORRECT_USAGE")], + [[], null, null, self::respErr("INCORRECT_USAGE")], ]; } @@ -934,34 +934,34 @@ LONG_STRING; } } - public function provideLabelRenamings(): iterable { + public static function provideLabelRenamings(): iterable { return [ - [['label_id' => -1042, 'caption' => "Ook"], [$this->userId, 18, ['name' => "Ook"]], true, $this->respGood()], - [['label_id' => -2112, 'caption' => "Eek"], [$this->userId, 1088, ['name' => "Eek"]], new ExceptionInput("subjectMissing"), $this->respGood()], - [['label_id' => -1042, 'caption' => "Eek"], [$this->userId, 18, ['name' => "Eek"]], new ExceptionInput("constraintViolation"), $this->respGood()], - [['label_id' => -1042, 'caption' => ""], [$this->userId, 18, ['name' => ""]], new ExceptionInput("missing"), $this->respGood()], - [['label_id' => -1042, 'caption' => " "], [$this->userId, 18, ['name' => " "]], new ExceptionInput("whitespace"), $this->respGood()], - [['label_id' => -1042], [$this->userId, 18, ['name' => ""]], new ExceptionInput("missing"), $this->respGood()], - [['label_id' => -1042], [$this->userId, 18, ['name' => ""]], new ExceptionInput("typeViolation"), $this->respErr("INCORRECT_USAGE")], - [['label_id' => -1, 'caption' => "Ook"], null, null, $this->respErr("INCORRECT_USAGE")], - [['caption' => "Ook"], null, null, $this->respErr("INCORRECT_USAGE")], - [[], null, null, $this->respErr("INCORRECT_USAGE")], + [['label_id' => -1042, 'caption' => "Ook"], [self::$userId, 18, ['name' => "Ook"]], true, self::respGood()], + [['label_id' => -2112, 'caption' => "Eek"], [self::$userId, 1088, ['name' => "Eek"]], new ExceptionInput("subjectMissing"), self::respGood()], + [['label_id' => -1042, 'caption' => "Eek"], [self::$userId, 18, ['name' => "Eek"]], new ExceptionInput("constraintViolation"), self::respGood()], + [['label_id' => -1042, 'caption' => ""], [self::$userId, 18, ['name' => ""]], new ExceptionInput("missing"), self::respGood()], + [['label_id' => -1042, 'caption' => " "], [self::$userId, 18, ['name' => " "]], new ExceptionInput("whitespace"), self::respGood()], + [['label_id' => -1042], [self::$userId, 18, ['name' => ""]], new ExceptionInput("missing"), self::respGood()], + [['label_id' => -1042], [self::$userId, 18, ['name' => ""]], new ExceptionInput("typeViolation"), self::respErr("INCORRECT_USAGE")], + [['label_id' => -1, 'caption' => "Ook"], null, null, self::respErr("INCORRECT_USAGE")], + [['caption' => "Ook"], null, null, self::respErr("INCORRECT_USAGE")], + [[], null, null, self::respErr("INCORRECT_USAGE")], ]; } /** @dataProvider provideCategoryListings */ public function testRetrieveCategoryLists(array $in, ResponseInterface $exp): void { $in = array_merge(['op' => "getCategories", 'sid' => "PriestsOfSyrinx"], $in); - \Phake::when(Arsse::$db)->folderList($this->anything(), null, true)->thenReturn(new Result($this->v($this->folders))); - \Phake::when(Arsse::$db)->folderList($this->anything(), null, false)->thenReturn(new Result($this->v($this->topFolders))); - \Phake::when(Arsse::$db)->subscriptionList->thenReturn(new Result($this->v($this->subscriptions))); - \Phake::when(Arsse::$db)->labelList->thenReturn(new Result($this->v($this->labels))); + \Phake::when(Arsse::$db)->folderList($this->anything(), null, true)->thenReturn(new Result(self::v($this->folders))); + \Phake::when(Arsse::$db)->folderList($this->anything(), null, false)->thenReturn(new Result(self::v($this->topFolders))); + \Phake::when(Arsse::$db)->subscriptionList->thenReturn(new Result(self::v($this->subscriptions))); + \Phake::when(Arsse::$db)->labelList->thenReturn(new Result(self::v($this->labels))); \Phake::when(Arsse::$db)->articleCount($this->anything(), $this->equalTo((new Context)->hidden(false)->unread(true)->modifiedRange(Date::sub("PT24H", self::NOW), null)))->thenReturn(7); - \Phake::when(Arsse::$db)->articleStarred->thenReturn($this->v($this->starred)); + \Phake::when(Arsse::$db)->articleStarred->thenReturn(self::v($this->starred)); $this->assertMessage($exp, $this->req($in)); } - public function provideCategoryListings(): iterable { + public static function provideCategoryListings(): iterable { $exp = [ [ ['id' => "5", 'title' => "Local", 'unread' => 10, 'order_id' => 1], @@ -1015,22 +1015,22 @@ LONG_STRING; ], ]; return [ - [['include_empty' => true], $this->respGood($exp[0])], - [[], $this->respGood($exp[1])], - [['unread_only' => true], $this->respGood($exp[2])], - [['enable_nested' => true, 'include_empty' => true], $this->respGood($exp[3])], - [['enable_nested' => true], $this->respGood($exp[4])], - [['enable_nested' => true, 'unread_only' => true], $this->respGood($exp[5])], + [['include_empty' => true], self::respGood($exp[0])], + [[], self::respGood($exp[1])], + [['unread_only' => true], self::respGood($exp[2])], + [['enable_nested' => true, 'include_empty' => true], self::respGood($exp[3])], + [['enable_nested' => true], self::respGood($exp[4])], + [['enable_nested' => true, 'unread_only' => true], self::respGood($exp[5])], ]; } public function testRetrieveCounterList(): void { $in = ['op' => "getCounters", 'sid' => "PriestsOfSyrinx"]; - \Phake::when(Arsse::$db)->folderList->thenReturn(new Result($this->v($this->folders))); - \Phake::when(Arsse::$db)->subscriptionList->thenReturn(new Result($this->v($this->subscriptions))); - \Phake::when(Arsse::$db)->labelList($this->anything(), false)->thenReturn(new Result($this->v($this->usedLabels))); + \Phake::when(Arsse::$db)->folderList->thenReturn(new Result(self::v($this->folders))); + \Phake::when(Arsse::$db)->subscriptionList->thenReturn(new Result(self::v($this->subscriptions))); + \Phake::when(Arsse::$db)->labelList($this->anything(), false)->thenReturn(new Result(self::v($this->usedLabels))); \Phake::when(Arsse::$db)->articleCount->thenReturn(7); - \Phake::when(Arsse::$db)->articleStarred->thenReturn($this->v($this->starred)); + \Phake::when(Arsse::$db)->articleStarred->thenReturn(self::v($this->starred)); $exp = [ ['id' => "global-unread", 'counter' => 35], ['id' => "subscribed-feeds", 'counter' => 6], @@ -1056,22 +1056,22 @@ LONG_STRING; ['id' => 0, 'kind' => "cat", 'counter' => 0], ['id' => -2, 'kind' => "cat", 'counter' => 6], ]; - $this->assertMessage($this->respGood($exp), $this->req($in)); - \Phake::verify(Arsse::$db)->articleCount($this->userId, $this->equalTo((new Context)->hidden(false)->unread(true)->modifiedRange(Date::sub("PT24H", self::NOW), null))); + $this->assertMessage(self::respGood($exp), $this->req($in)); + \Phake::verify(Arsse::$db)->articleCount(self::$userId, $this->equalTo((new Context)->hidden(false)->unread(true)->modifiedRange(Date::sub("PT24H", self::NOW), null))); } /** @dataProvider provideLabelListings */ public function testRetrieveTheLabelList(array $in, ResponseInterface $exp): void { $in = array_merge(['op' => "getLabels", 'sid' => "PriestsOfSyrinx"], $in); - \Phake::when(Arsse::$db)->labelList->thenReturn(new Result($this->v($this->labels))); - \Phake::when(Arsse::$db)->articleLabelsGet($this->anything(), 1)->thenReturn($this->v([1,3])); - \Phake::when(Arsse::$db)->articleLabelsGet($this->anything(), 2)->thenReturn($this->v([3])); + \Phake::when(Arsse::$db)->labelList->thenReturn(new Result(self::v($this->labels))); + \Phake::when(Arsse::$db)->articleLabelsGet($this->anything(), 1)->thenReturn(self::v([1,3])); + \Phake::when(Arsse::$db)->articleLabelsGet($this->anything(), 2)->thenReturn(self::v([3])); \Phake::when(Arsse::$db)->articleLabelsGet($this->anything(), 3)->thenReturn([]); \Phake::when(Arsse::$db)->articleLabelsGet($this->anything(), 4)->thenThrow(new ExceptionInput("idMissing")); $this->assertMessage($exp, $this->req($in)); } - public function provideLabelListings(): iterable { + public static function provideLabelListings(): iterable { $exp = [ [ ['id' => -1027, 'caption' => "Fascinating", 'fg_color' => "", 'bg_color' => "", 'checked' => false], @@ -1100,37 +1100,37 @@ LONG_STRING; ], ]; return [ - [[], $this->respGood($exp[0])], - [['article_id' => 1], $this->respGood($exp[1])], - [['article_id' => 2], $this->respGood($exp[2])], - [['article_id' => 3], $this->respGood($exp[3])], - [['article_id' => 4], $this->respGood($exp[4])], + [[], self::respGood($exp[0])], + [['article_id' => 1], self::respGood($exp[1])], + [['article_id' => 2], self::respGood($exp[2])], + [['article_id' => 3], self::respGood($exp[3])], + [['article_id' => 4], self::respGood($exp[4])], ]; } - public function provideLabelAssignments(): iterable { + public static function provideLabelAssignments(): iterable { $ids = implode(",", range(1, 100)); return [ - [['label_id' => -2112, 'article_ids' => $ids], 1088, Database::ASSOC_REMOVE, $this->respGood(['status' => "OK", 'updated' => 89])], - [['label_id' => -2112, 'article_ids' => $ids, 'assign' => true], 1088, Database::ASSOC_ADD, $this->respGood(['status' => "OK", 'updated' => 7])], - [['label_id' => -2112], null, null, $this->respGood(['status' => "OK", 'updated' => 0])], - [['label_id' => -42], null, null, $this->respErr("INCORRECT_USAGE")], - [['label_id' => 42], null, null, $this->respErr("INCORRECT_USAGE")], - [['label_id' => 0], null, null, $this->respErr("INCORRECT_USAGE")], - [[], null, null, $this->respErr("INCORRECT_USAGE")], + [['label_id' => -2112, 'article_ids' => $ids], 1088, Database::ASSOC_REMOVE, self::respGood(['status' => "OK", 'updated' => 89])], + [['label_id' => -2112, 'article_ids' => $ids, 'assign' => true], 1088, Database::ASSOC_ADD, self::respGood(['status' => "OK", 'updated' => 7])], + [['label_id' => -2112], null, null, self::respGood(['status' => "OK", 'updated' => 0])], + [['label_id' => -42], null, null, self::respErr("INCORRECT_USAGE")], + [['label_id' => 42], null, null, self::respErr("INCORRECT_USAGE")], + [['label_id' => 0], null, null, self::respErr("INCORRECT_USAGE")], + [[], null, null, self::respErr("INCORRECT_USAGE")], ]; } /** @dataProvider provideLabelAssignments */ public function testAssignArticlesToALabel(array $in, ?int $label, ?int $operation, ResponseInterface $exp): void { $in = array_merge(['op' => "setArticleLabel", 'sid' => "PriestsOfSyrinx"], $in); - \Phake::when(Arsse::$db)->labelArticlesSet($this->userId, $this->anything(), $this->anything(), Database::ASSOC_REMOVE)->thenReturn(42)->thenReturn(47); - \Phake::when(Arsse::$db)->labelArticlesSet($this->userId, $this->anything(), $this->anything(), Database::ASSOC_ADD)->thenReturn(5)->thenReturn(2); - \Phake::when(Arsse::$db)->labelArticlesSet($this->userId, $this->anything(), $this->equalTo((new Context)->articles([])), $this->anything())->thenThrow(new ExceptionInput("tooShort")); + \Phake::when(Arsse::$db)->labelArticlesSet(self::$userId, $this->anything(), $this->anything(), Database::ASSOC_REMOVE)->thenReturn(42)->thenReturn(47); + \Phake::when(Arsse::$db)->labelArticlesSet(self::$userId, $this->anything(), $this->anything(), Database::ASSOC_ADD)->thenReturn(5)->thenReturn(2); + \Phake::when(Arsse::$db)->labelArticlesSet(self::$userId, $this->anything(), $this->equalTo((new Context)->articles([])), $this->anything())->thenThrow(new ExceptionInput("tooShort")); $this->assertMessage($exp, $this->req($in)); if ($label !== null) { - \Phake::verify(Arsse::$db)->labelArticlesSet($this->userId, $label, $this->equalTo((new Context)->articles(range(1, 50))), $operation); - \Phake::verify(Arsse::$db)->labelArticlesSet($this->userId, $label, $this->equalTo((new Context)->articles(range(51, 100))), $operation); + \Phake::verify(Arsse::$db)->labelArticlesSet(self::$userId, $label, $this->equalTo((new Context)->articles(range(1, 50))), $operation); + \Phake::verify(Arsse::$db)->labelArticlesSet(self::$userId, $label, $this->equalTo((new Context)->articles(range(51, 100))), $operation); } } @@ -1139,17 +1139,17 @@ LONG_STRING; ['op' => "getFeedTree", 'sid' => "PriestsOfSyrinx", 'include_empty' => true], ['op' => "getFeedTree", 'sid' => "PriestsOfSyrinx"], ]; - \Phake::when(Arsse::$db)->folderList($this->anything(), null, true)->thenReturn(new Result($this->v($this->folders))); - \Phake::when(Arsse::$db)->subscriptionList->thenReturn(new Result($this->v($this->subscriptions))); - \Phake::when(Arsse::$db)->labelList($this->anything(), true)->thenReturn(new Result($this->v($this->labels))); + \Phake::when(Arsse::$db)->folderList($this->anything(), null, true)->thenReturn(new Result(self::v($this->folders))); + \Phake::when(Arsse::$db)->subscriptionList->thenReturn(new Result(self::v($this->subscriptions))); + \Phake::when(Arsse::$db)->labelList($this->anything(), true)->thenReturn(new Result(self::v($this->labels))); \Phake::when(Arsse::$db)->articleCount->thenReturn(7); - \Phake::when(Arsse::$db)->articleStarred->thenReturn($this->v($this->starred)); + \Phake::when(Arsse::$db)->articleStarred->thenReturn(self::v($this->starred)); // the expectations are packed tightly since they're very verbose; one can use var_export() (or convert to JSON) to pretty-print them $exp = ['categories' => ['identifier' => 'id','label' => 'name','items' => [['name' => 'Special','id' => 'CAT:-1','bare_id' => -1,'type' => 'category','unread' => 0,'items' => [['name' => 'All articles','id' => 'FEED:-4','bare_id' => -4,'icon' => 'images/folder.png','unread' => 35,'type' => 'feed','auxcounter' => 0,'error' => '','updated' => ''],['name' => 'Fresh articles','id' => 'FEED:-3','bare_id' => -3,'icon' => 'images/fresh.png','unread' => 7,'type' => 'feed','auxcounter' => 0,'error' => '','updated' => ''],['name' => 'Starred articles','id' => 'FEED:-1','bare_id' => -1,'icon' => 'images/star.png','unread' => 4,'type' => 'feed','auxcounter' => 0,'error' => '','updated' => ''],['name' => 'Published articles','id' => 'FEED:-2','bare_id' => -2,'icon' => 'images/feed.png','unread' => 0,'type' => 'feed','auxcounter' => 0,'error' => '','updated' => ''],['name' => 'Archived articles','id' => 'FEED:0','bare_id' => 0,'icon' => 'images/archive.png','unread' => 0,'type' => 'feed','auxcounter' => 0,'error' => '','updated' => ''],['name' => 'Recently read','id' => 'FEED:-6','bare_id' => -6,'icon' => 'images/time.png','unread' => 0,'type' => 'feed','auxcounter' => 0,'error' => '','updated' => '']]],['name' => 'Labels','id' => 'CAT:-2','bare_id' => -2,'type' => 'category','unread' => 6,'items' => [['name' => 'Fascinating','id' => 'FEED:-1027','bare_id' => -1027,'unread' => 0,'icon' => 'images/label.png','type' => 'feed','auxcounter' => 0,'error' => '','updated' => '','fg_color' => '','bg_color' => ''],['name' => 'Interesting','id' => 'FEED:-1029','bare_id' => -1029,'unread' => 0,'icon' => 'images/label.png','type' => 'feed','auxcounter' => 0,'error' => '','updated' => '','fg_color' => '','bg_color' => ''],['name' => 'Logical','id' => 'FEED:-1025','bare_id' => -1025,'unread' => 0,'icon' => 'images/label.png','type' => 'feed','auxcounter' => 0,'error' => '','updated' => '','fg_color' => '','bg_color' => '']]],['name' => 'Photography','id' => 'CAT:4','bare_id' => 4,'parent_id' => null,'type' => 'category','auxcounter' => 0,'unread' => 0,'child_unread' => 0,'checkbox' => false,'param' => '(0 feeds)','items' => []],['name' => 'Politics','id' => 'CAT:3','bare_id' => 3,'parent_id' => null,'type' => 'category','auxcounter' => 0,'unread' => 0,'child_unread' => 0,'checkbox' => false,'param' => '(3 feeds)','items' => [['name' => 'Local','id' => 'CAT:5','bare_id' => 5,'parent_id' => 3,'type' => 'category','auxcounter' => 0,'unread' => 0,'child_unread' => 0,'checkbox' => false,'param' => '(1 feed)','items' => [['name' => 'Toronto Star','id' => 'FEED:2','bare_id' => 2,'icon' => 'feed-icons/2.ico','error' => 'oops','param' => '2011-11-11T11:11:11Z','unread' => 0,'auxcounter' => 0,'checkbox' => false]]],['name' => 'National','id' => 'CAT:6','bare_id' => 6,'parent_id' => 3,'type' => 'category','auxcounter' => 0,'unread' => 0,'child_unread' => 0,'checkbox' => false,'param' => '(2 feeds)','items' => [['name' => 'CBC News','id' => 'FEED:4','bare_id' => 4,'icon' => 'feed-icons/4.ico','error' => '','param' => '2017-10-09T15:58:34Z','unread' => 0,'auxcounter' => 0,'checkbox' => false],['name' => 'Ottawa Citizen','id' => 'FEED:5','bare_id' => 5,'icon' => false,'error' => '','param' => '2017-07-07T17:07:17Z','unread' => 0,'auxcounter' => 0,'checkbox' => false]]]]],['name' => 'Science','id' => 'CAT:1','bare_id' => 1,'parent_id' => null,'type' => 'category','auxcounter' => 0,'unread' => 0,'child_unread' => 0,'checkbox' => false,'param' => '(2 feeds)','items' => [['name' => 'Rocketry','id' => 'CAT:2','bare_id' => 2,'parent_id' => 1,'type' => 'category','auxcounter' => 0,'unread' => 0,'child_unread' => 0,'checkbox' => false,'param' => '(1 feed)','items' => [['name' => 'NASA JPL','id' => 'FEED:1','bare_id' => 1,'icon' => false,'error' => '','param' => '2017-09-15T22:54:16Z','unread' => 0,'auxcounter' => 0,'checkbox' => false]]],['name' => 'Ars Technica','id' => 'FEED:3','bare_id' => 3,'icon' => 'feed-icons/3.ico','error' => 'argh','param' => '2016-05-23T06:40:02Z','unread' => 0,'auxcounter' => 0,'checkbox' => false]]],['name' => 'Uncategorized','id' => 'CAT:0','bare_id' => 0,'type' => 'category','auxcounter' => 0,'unread' => 0,'child_unread' => 0,'checkbox' => false,'parent_id' => null,'param' => '(1 feed)','items' => [['name' => 'Eurogamer','id' => 'FEED:6','bare_id' => 6,'icon' => 'feed-icons/6.ico','error' => '','param' => '2010-02-12T20:08:47Z','unread' => 0,'auxcounter' => 0,'checkbox' => false]]]]]]; - $this->assertMessage($this->respGood($exp), $this->req($in[0])); + $this->assertMessage(self::respGood($exp), $this->req($in[0])); $exp = ['categories' => ['identifier' => 'id','label' => 'name','items' => [['name' => 'Special','id' => 'CAT:-1','bare_id' => -1,'type' => 'category','unread' => 0,'items' => [['name' => 'All articles','id' => 'FEED:-4','bare_id' => -4,'icon' => 'images/folder.png','unread' => 35,'type' => 'feed','auxcounter' => 0,'error' => '','updated' => ''],['name' => 'Fresh articles','id' => 'FEED:-3','bare_id' => -3,'icon' => 'images/fresh.png','unread' => 7,'type' => 'feed','auxcounter' => 0,'error' => '','updated' => ''],['name' => 'Starred articles','id' => 'FEED:-1','bare_id' => -1,'icon' => 'images/star.png','unread' => 4,'type' => 'feed','auxcounter' => 0,'error' => '','updated' => ''],['name' => 'Published articles','id' => 'FEED:-2','bare_id' => -2,'icon' => 'images/feed.png','unread' => 0,'type' => 'feed','auxcounter' => 0,'error' => '','updated' => ''],['name' => 'Archived articles','id' => 'FEED:0','bare_id' => 0,'icon' => 'images/archive.png','unread' => 0,'type' => 'feed','auxcounter' => 0,'error' => '','updated' => ''],['name' => 'Recently read','id' => 'FEED:-6','bare_id' => -6,'icon' => 'images/time.png','unread' => 0,'type' => 'feed','auxcounter' => 0,'error' => '','updated' => '']]],['name' => 'Labels','id' => 'CAT:-2','bare_id' => -2,'type' => 'category','unread' => 6,'items' => [['name' => 'Fascinating','id' => 'FEED:-1027','bare_id' => -1027,'unread' => 0,'icon' => 'images/label.png','type' => 'feed','auxcounter' => 0,'error' => '','updated' => '','fg_color' => '','bg_color' => ''],['name' => 'Interesting','id' => 'FEED:-1029','bare_id' => -1029,'unread' => 0,'icon' => 'images/label.png','type' => 'feed','auxcounter' => 0,'error' => '','updated' => '','fg_color' => '','bg_color' => ''],['name' => 'Logical','id' => 'FEED:-1025','bare_id' => -1025,'unread' => 0,'icon' => 'images/label.png','type' => 'feed','auxcounter' => 0,'error' => '','updated' => '','fg_color' => '','bg_color' => '']]],['name' => 'Politics','id' => 'CAT:3','bare_id' => 3,'parent_id' => null,'type' => 'category','auxcounter' => 0,'unread' => 0,'child_unread' => 0,'checkbox' => false,'param' => '(3 feeds)','items' => [['name' => 'Local','id' => 'CAT:5','bare_id' => 5,'parent_id' => 3,'type' => 'category','auxcounter' => 0,'unread' => 0,'child_unread' => 0,'checkbox' => false,'param' => '(1 feed)','items' => [['name' => 'Toronto Star','id' => 'FEED:2','bare_id' => 2,'icon' => 'feed-icons/2.ico','error' => 'oops','param' => '2011-11-11T11:11:11Z','unread' => 0,'auxcounter' => 0,'checkbox' => false]]],['name' => 'National','id' => 'CAT:6','bare_id' => 6,'parent_id' => 3,'type' => 'category','auxcounter' => 0,'unread' => 0,'child_unread' => 0,'checkbox' => false,'param' => '(2 feeds)','items' => [['name' => 'CBC News','id' => 'FEED:4','bare_id' => 4,'icon' => 'feed-icons/4.ico','error' => '','param' => '2017-10-09T15:58:34Z','unread' => 0,'auxcounter' => 0,'checkbox' => false],['name' => 'Ottawa Citizen','id' => 'FEED:5','bare_id' => 5,'icon' => false,'error' => '','param' => '2017-07-07T17:07:17Z','unread' => 0,'auxcounter' => 0,'checkbox' => false]]]]],['name' => 'Science','id' => 'CAT:1','bare_id' => 1,'parent_id' => null,'type' => 'category','auxcounter' => 0,'unread' => 0,'child_unread' => 0,'checkbox' => false,'param' => '(2 feeds)','items' => [['name' => 'Rocketry','id' => 'CAT:2','bare_id' => 2,'parent_id' => 1,'type' => 'category','auxcounter' => 0,'unread' => 0,'child_unread' => 0,'checkbox' => false,'param' => '(1 feed)','items' => [['name' => 'NASA JPL','id' => 'FEED:1','bare_id' => 1,'icon' => false,'error' => '','param' => '2017-09-15T22:54:16Z','unread' => 0,'auxcounter' => 0,'checkbox' => false]]],['name' => 'Ars Technica','id' => 'FEED:3','bare_id' => 3,'icon' => 'feed-icons/3.ico','error' => 'argh','param' => '2016-05-23T06:40:02Z','unread' => 0,'auxcounter' => 0,'checkbox' => false]]],['name' => 'Uncategorized','id' => 'CAT:0','bare_id' => 0,'type' => 'category','auxcounter' => 0,'unread' => 0,'child_unread' => 0,'checkbox' => false,'parent_id' => null,'param' => '(1 feed)','items' => [['name' => 'Eurogamer','id' => 'FEED:6','bare_id' => 6,'icon' => 'feed-icons/6.ico','error' => '','param' => '2010-02-12T20:08:47Z','unread' => 0,'auxcounter' => 0,'checkbox' => false]]]]]]; - $this->assertMessage($this->respGood($exp), $this->req($in[1])); - \Phake::verify(Arsse::$db, \Phake::times(2))->articleCount($this->userId, $this->equalTo((new Context)->hidden(false)->unread(true)->modifiedRange(Date::sub("PT24H", self::NOW), null))); + $this->assertMessage(self::respGood($exp), $this->req($in[1])); + \Phake::verify(Arsse::$db, \Phake::times(2))->articleCount(self::$userId, $this->equalTo((new Context)->hidden(false)->unread(true)->modifiedRange(Date::sub("PT24H", self::NOW), null))); } /** @dataProvider provideMassMarkings */ @@ -1160,15 +1160,15 @@ LONG_STRING; // create a mock-current time \Phake::when(Arsse::$obj)->get(\DateTimeImmutable::class)->thenReturn(new \DateTimeImmutable(self::NOW)); // TT-RSS always responds the same regardless of success or failure - $this->assertMessage($this->respGood(['status' => "OK"]), $this->req($in)); + $this->assertMessage(self::respGood(['status' => "OK"]), $this->req($in)); if (isset($c)) { - \Phake::verify(Arsse::$db)->articleMark($this->userId, ['read' => true], $this->equalTo($c)); + \Phake::verify(Arsse::$db)->articleMark(self::$userId, ['read' => true], $this->equalTo($c)); } else { \Phake::verify(Arsse::$db, \Phake::never())->articleMark(\Phake::anyParameters()); } } - public function provideMassMarkings(): iterable { + public static function provideMassMarkings(): iterable { $c = (new Context)->hidden(false); return [ [[], null], @@ -1198,24 +1198,24 @@ LONG_STRING; public function testRetrieveFeedList(array $in, ResponseInterface $exp): void { $in = array_merge(['op' => "getFeeds", 'sid' => "PriestsOfSyrinx"], $in); // statistical mocks - \Phake::when(Arsse::$db)->articleStarred->thenReturn($this->v($this->starred)); + \Phake::when(Arsse::$db)->articleStarred->thenReturn(self::v($this->starred)); \Phake::when(Arsse::$db)->articleCount($this->anything(), $this->equalTo((new Context)->unread(true)->hidden(false)->modifiedRange(Date::sub("PT24H", self::NOW), null)))->thenReturn(7); \Phake::when(Arsse::$db)->articleCount($this->anything(), $this->equalTo((new Context)->unread(true)->hidden(false)))->thenReturn(35); // label mocks - \Phake::when(Arsse::$db)->labelList->thenReturn(new Result($this->v($this->labels))); - \Phake::when(Arsse::$db)->labelList($this->anything(), false)->thenReturn(new Result($this->v($this->usedLabels))); + \Phake::when(Arsse::$db)->labelList->thenReturn(new Result(self::v($this->labels))); + \Phake::when(Arsse::$db)->labelList($this->anything(), false)->thenReturn(new Result(self::v($this->usedLabels))); // subscription and folder list and unread count mocks \Phake::when(Arsse::$db)->folderList->thenThrow(new ExceptionInput("subjectMissing")); \Phake::when(Arsse::$db)->subscriptionList->thenThrow(new ExceptionInput("subjectMissing")); - \Phake::when(Arsse::$db)->folderList($this->anything())->thenReturn(new Result($this->v($this->folders))); - \Phake::when(Arsse::$db)->subscriptionList($this->anything(), null, true)->thenReturn(new Result($this->v($this->subscriptions))); - \Phake::when(Arsse::$db)->subscriptionList($this->anything(), null, false)->thenReturn(new Result($this->v($this->filterSubs(null)))); - \Phake::when(Arsse::$db)->folderList($this->anything(), null)->thenReturn(new Result($this->v($this->folders))); - \Phake::when(Arsse::$db)->folderList($this->anything(), null, false)->thenReturn(new Result($this->v($this->filterFolders(null)))); + \Phake::when(Arsse::$db)->folderList($this->anything())->thenReturn(new Result(self::v($this->folders))); + \Phake::when(Arsse::$db)->subscriptionList($this->anything(), null, true)->thenReturn(new Result(self::v($this->subscriptions))); + \Phake::when(Arsse::$db)->subscriptionList($this->anything(), null, false)->thenReturn(new Result(self::v($this->filterSubs(null)))); + \Phake::when(Arsse::$db)->folderList($this->anything(), null)->thenReturn(new Result(self::v($this->folders))); + \Phake::when(Arsse::$db)->folderList($this->anything(), null, false)->thenReturn(new Result(self::v($this->filterFolders(null)))); foreach ($this->folders as $f) { - \Phake::when(Arsse::$db)->folderList($this->anything(), $f['id'], false)->thenReturn(new Result($this->v($this->filterFolders($f['id'])))); + \Phake::when(Arsse::$db)->folderList($this->anything(), $f['id'], false)->thenReturn(new Result(self::v($this->filterFolders($f['id'])))); \Phake::when(Arsse::$db)->articleCount($this->anything(), $this->equalTo((new Context)->unread(true)->hidden(false)->folder($f['id'])))->thenReturn($this->reduceFolders($f['id'])); - \Phake::when(Arsse::$db)->subscriptionList($this->anything(), $f['id'], false)->thenReturn(new Result($this->v($this->filterSubs($f['id'])))); + \Phake::when(Arsse::$db)->subscriptionList($this->anything(), $f['id'], false)->thenReturn(new Result(self::v($this->filterSubs($f['id'])))); } $this->assertMessage($exp, $this->req($in)); } @@ -1245,7 +1245,7 @@ LONG_STRING; return $out; } - public function provideFeedListings(): iterable { + public static function provideFeedListings(): iterable { $exp = [ [ ['id' => 6, 'title' => 'Eurogamer', 'unread' => 0, 'cat_id' => 0, 'feed_url' => " http://example.com/6", 'has_icon' => true, 'last_updated' => 1266005327, 'order_id' => 1], @@ -1331,25 +1331,25 @@ LONG_STRING; ], ]; return [ - [[], $this->respGood($exp[0])], - [['cat_id' => -1], $this->respGood($exp[1])], - [['cat_id' => -1, 'unread_only' => true], $this->respGood($exp[2])], - [['cat_id' => -2], $this->respGood($exp[3])], - [['cat_id' => -2, 'unread_only' => true], $this->respGood($exp[4])], - [['cat_id' => -3], $this->respGood($exp[5])], - [['cat_id' => -3, 'unread_only' => true], $this->respGood($exp[6])], - [['cat_id' => -4], $this->respGood($exp[7])], - [['cat_id' => -4, 'unread_only' => true], $this->respGood($exp[8])], - [['cat_id' => 6], $this->respGood($exp[9])], - [['cat_id' => 6, 'limit' => 1], $this->respGood($exp[10])], - [['cat_id' => 6, 'limit' => 1, 'offset' => 1], $this->respGood($exp[11])], - [['cat_id' => 1], $this->respGood($exp[12])], - [['cat_id' => 1, 'include_nested' => true], $this->respGood($exp[13])], - [['cat_id' => 0, 'unread_only' => true], $this->respGood([])], - [['cat_id' => 2112], $this->respGood([])], - [['cat_id' => 2112, 'include_nested' => true], $this->respGood([])], - [['cat_id' => 6, 'limit' => -42], $this->respGood([])], - [['cat_id' => 6, 'offset' => 2], $this->respGood([])], + [[], self::respGood($exp[0])], + [['cat_id' => -1], self::respGood($exp[1])], + [['cat_id' => -1, 'unread_only' => true], self::respGood($exp[2])], + [['cat_id' => -2], self::respGood($exp[3])], + [['cat_id' => -2, 'unread_only' => true], self::respGood($exp[4])], + [['cat_id' => -3], self::respGood($exp[5])], + [['cat_id' => -3, 'unread_only' => true], self::respGood($exp[6])], + [['cat_id' => -4], self::respGood($exp[7])], + [['cat_id' => -4, 'unread_only' => true], self::respGood($exp[8])], + [['cat_id' => 6], self::respGood($exp[9])], + [['cat_id' => 6, 'limit' => 1], self::respGood($exp[10])], + [['cat_id' => 6, 'limit' => 1, 'offset' => 1], self::respGood($exp[11])], + [['cat_id' => 1], self::respGood($exp[12])], + [['cat_id' => 1, 'include_nested' => true], self::respGood($exp[13])], + [['cat_id' => 0, 'unread_only' => true], self::respGood([])], + [['cat_id' => 2112], self::respGood([])], + [['cat_id' => 2112, 'include_nested' => true], self::respGood([])], + [['cat_id' => 6, 'limit' => -42], self::respGood([])], + [['cat_id' => 6, 'offset' => 2], self::respGood([])], ]; } @@ -1357,67 +1357,67 @@ LONG_STRING; public function testChangeArticles(array $in, ResponseInterface $exp): void { $in = array_merge(['op' => "updateArticle", 'sid' => "PriestsOfSyrinx"], $in); \Phake::when(Arsse::$db)->articleMark->thenReturn(1); - \Phake::when(Arsse::$db)->articleMark($this->userId, ['starred' => false], $this->equalTo((new Context)->articles([42, 2112])))->thenReturn(2); - \Phake::when(Arsse::$db)->articleMark($this->userId, ['starred' => true], $this->equalTo((new Context)->articles([42, 2112])))->thenReturn(4); - \Phake::when(Arsse::$db)->articleMark($this->userId, ['starred' => false], $this->equalTo((new Context)->articles([42])))->thenReturn(8); - \Phake::when(Arsse::$db)->articleMark($this->userId, ['starred' => true], $this->equalTo((new Context)->articles([2112])))->thenReturn(16); - \Phake::when(Arsse::$db)->articleMark($this->userId, ['read' => true], $this->equalTo((new Context)->articles([42, 2112])))->thenReturn(32); // false is read for TT-RSS - \Phake::when(Arsse::$db)->articleMark($this->userId, ['read' => false], $this->equalTo((new Context)->articles([42, 2112])))->thenReturn(64); - \Phake::when(Arsse::$db)->articleMark($this->userId, ['read' => true], $this->equalTo((new Context)->articles([42])))->thenReturn(128); - \Phake::when(Arsse::$db)->articleMark($this->userId, ['read' => false], $this->equalTo((new Context)->articles([2112])))->thenReturn(256); - \Phake::when(Arsse::$db)->articleMark($this->userId, ['note' => ""], $this->equalTo((new Context)->articles([42, 2112])))->thenReturn(512); - \Phake::when(Arsse::$db)->articleMark($this->userId, ['note' => "eh"], $this->equalTo((new Context)->articles([42, 2112])))->thenReturn(1024); - \Phake::when(Arsse::$db)->articleList($this->userId, $this->equalTo((new Context)->articles([42, 2112])->starred(true)), $this->anything())->thenReturn(new Result($this->v([['id' => 42]]))); - \Phake::when(Arsse::$db)->articleList($this->userId, $this->equalTo((new Context)->articles([42, 2112])->starred(false)), $this->anything())->thenReturn(new Result($this->v([['id' => 2112]]))); - \Phake::when(Arsse::$db)->articleList($this->userId, $this->equalTo((new Context)->articles([42, 2112])->unread(true)), $this->anything())->thenReturn(new Result($this->v([['id' => 42]]))); - \Phake::when(Arsse::$db)->articleList($this->userId, $this->equalTo((new Context)->articles([42, 2112])->unread(false)), $this->anything())->thenReturn(new Result($this->v([['id' => 2112]]))); + \Phake::when(Arsse::$db)->articleMark(self::$userId, ['starred' => false], $this->equalTo((new Context)->articles([42, 2112])))->thenReturn(2); + \Phake::when(Arsse::$db)->articleMark(self::$userId, ['starred' => true], $this->equalTo((new Context)->articles([42, 2112])))->thenReturn(4); + \Phake::when(Arsse::$db)->articleMark(self::$userId, ['starred' => false], $this->equalTo((new Context)->articles([42])))->thenReturn(8); + \Phake::when(Arsse::$db)->articleMark(self::$userId, ['starred' => true], $this->equalTo((new Context)->articles([2112])))->thenReturn(16); + \Phake::when(Arsse::$db)->articleMark(self::$userId, ['read' => true], $this->equalTo((new Context)->articles([42, 2112])))->thenReturn(32); // false is read for TT-RSS + \Phake::when(Arsse::$db)->articleMark(self::$userId, ['read' => false], $this->equalTo((new Context)->articles([42, 2112])))->thenReturn(64); + \Phake::when(Arsse::$db)->articleMark(self::$userId, ['read' => true], $this->equalTo((new Context)->articles([42])))->thenReturn(128); + \Phake::when(Arsse::$db)->articleMark(self::$userId, ['read' => false], $this->equalTo((new Context)->articles([2112])))->thenReturn(256); + \Phake::when(Arsse::$db)->articleMark(self::$userId, ['note' => ""], $this->equalTo((new Context)->articles([42, 2112])))->thenReturn(512); + \Phake::when(Arsse::$db)->articleMark(self::$userId, ['note' => "eh"], $this->equalTo((new Context)->articles([42, 2112])))->thenReturn(1024); + \Phake::when(Arsse::$db)->articleList(self::$userId, $this->equalTo((new Context)->articles([42, 2112])->starred(true)), $this->anything())->thenReturn(new Result(self::v([['id' => 42]]))); + \Phake::when(Arsse::$db)->articleList(self::$userId, $this->equalTo((new Context)->articles([42, 2112])->starred(false)), $this->anything())->thenReturn(new Result(self::v([['id' => 2112]]))); + \Phake::when(Arsse::$db)->articleList(self::$userId, $this->equalTo((new Context)->articles([42, 2112])->unread(true)), $this->anything())->thenReturn(new Result(self::v([['id' => 42]]))); + \Phake::when(Arsse::$db)->articleList(self::$userId, $this->equalTo((new Context)->articles([42, 2112])->unread(false)), $this->anything())->thenReturn(new Result(self::v([['id' => 2112]]))); $this->assertMessage($exp, $this->req($in)); } - public function provideArticleChanges(): iterable { + public static function provideArticleChanges(): iterable { return [ - [[], $this->respErr("INCORRECT_USAGE")], - [['article_ids' => "42, 2112, -1"], $this->respGood(['status' => "OK", 'updated' => 2])], - [['article_ids' => "42, 2112, -1", 'field' => 0], $this->respGood(['status' => "OK", 'updated' => 2])], - [['article_ids' => "42, 2112, -1", 'field' => 0, 'mode' => 0], $this->respGood(['status' => "OK", 'updated' => 2])], - [['article_ids' => "42, 2112, -1", 'field' => 0, 'mode' => 1], $this->respGood(['status' => "OK", 'updated' => 4])], - [['article_ids' => "42, 2112, -1", 'field' => 0, 'mode' => 2], $this->respGood(['status' => "OK", 'updated' => 24])], - [['article_ids' => "42, 2112, -1", 'field' => 0, 'mode' => 3], $this->respErr("INCORRECT_USAGE")], - [['article_ids' => "42, 2112, -1", 'field' => 1], $this->respGood(['status' => "OK", 'updated' => 0])], - [['article_ids' => "42, 2112, -1", 'field' => 1, 'mode' => 0], $this->respGood(['status' => "OK", 'updated' => 0])], - [['article_ids' => "42, 2112, -1", 'field' => 1, 'mode' => 1], $this->respGood(['status' => "OK", 'updated' => 0])], - [['article_ids' => "42, 2112, -1", 'field' => 1, 'mode' => 2], $this->respGood(['status' => "OK", 'updated' => 0])], - [['article_ids' => "42, 2112, -1", 'field' => 1, 'mode' => 3], $this->respErr("INCORRECT_USAGE")], - [['article_ids' => "42, 2112, -1", 'field' => 2], $this->respGood(['status' => "OK", 'updated' => 32])], - [['article_ids' => "42, 2112, -1", 'field' => 2, 'mode' => 0], $this->respGood(['status' => "OK", 'updated' => 32])], - [['article_ids' => "42, 2112, -1", 'field' => 2, 'mode' => 1], $this->respGood(['status' => "OK", 'updated' => 64])], - [['article_ids' => "42, 2112, -1", 'field' => 2, 'mode' => 2], $this->respGood(['status' => "OK", 'updated' => 384])], - [['article_ids' => "42, 2112, -1", 'field' => 2, 'mode' => 3], $this->respErr("INCORRECT_USAGE")], - [['article_ids' => "42, 2112, -1", 'field' => 3], $this->respGood(['status' => "OK", 'updated' => 512])], - [['article_ids' => "42, 2112, -1", 'field' => 3, 'mode' => 0], $this->respGood(['status' => "OK", 'updated' => 512])], - [['article_ids' => "42, 2112, -1", 'field' => 3, 'mode' => 1], $this->respGood(['status' => "OK", 'updated' => 512])], - [['article_ids' => "42, 2112, -1", 'field' => 3, 'mode' => 2], $this->respGood(['status' => "OK", 'updated' => 512])], - [['article_ids' => "42, 2112, -1", 'field' => 3, 'mode' => 3], $this->respGood(['status' => "OK", 'updated' => 512])], - [['article_ids' => "42, 2112, -1", 'field' => 3, 'data' => "eh"], $this->respGood(['status' => "OK", 'updated' => 1024])], - [['article_ids' => "42, 2112, -1", 'field' => 4], $this->respErr("INCORRECT_USAGE")], - [['article_ids' => "0, -1", 'field' => 3], $this->respErr("INCORRECT_USAGE")], + [[], self::respErr("INCORRECT_USAGE")], + [['article_ids' => "42, 2112, -1"], self::respGood(['status' => "OK", 'updated' => 2])], + [['article_ids' => "42, 2112, -1", 'field' => 0], self::respGood(['status' => "OK", 'updated' => 2])], + [['article_ids' => "42, 2112, -1", 'field' => 0, 'mode' => 0], self::respGood(['status' => "OK", 'updated' => 2])], + [['article_ids' => "42, 2112, -1", 'field' => 0, 'mode' => 1], self::respGood(['status' => "OK", 'updated' => 4])], + [['article_ids' => "42, 2112, -1", 'field' => 0, 'mode' => 2], self::respGood(['status' => "OK", 'updated' => 24])], + [['article_ids' => "42, 2112, -1", 'field' => 0, 'mode' => 3], self::respErr("INCORRECT_USAGE")], + [['article_ids' => "42, 2112, -1", 'field' => 1], self::respGood(['status' => "OK", 'updated' => 0])], + [['article_ids' => "42, 2112, -1", 'field' => 1, 'mode' => 0], self::respGood(['status' => "OK", 'updated' => 0])], + [['article_ids' => "42, 2112, -1", 'field' => 1, 'mode' => 1], self::respGood(['status' => "OK", 'updated' => 0])], + [['article_ids' => "42, 2112, -1", 'field' => 1, 'mode' => 2], self::respGood(['status' => "OK", 'updated' => 0])], + [['article_ids' => "42, 2112, -1", 'field' => 1, 'mode' => 3], self::respErr("INCORRECT_USAGE")], + [['article_ids' => "42, 2112, -1", 'field' => 2], self::respGood(['status' => "OK", 'updated' => 32])], + [['article_ids' => "42, 2112, -1", 'field' => 2, 'mode' => 0], self::respGood(['status' => "OK", 'updated' => 32])], + [['article_ids' => "42, 2112, -1", 'field' => 2, 'mode' => 1], self::respGood(['status' => "OK", 'updated' => 64])], + [['article_ids' => "42, 2112, -1", 'field' => 2, 'mode' => 2], self::respGood(['status' => "OK", 'updated' => 384])], + [['article_ids' => "42, 2112, -1", 'field' => 2, 'mode' => 3], self::respErr("INCORRECT_USAGE")], + [['article_ids' => "42, 2112, -1", 'field' => 3], self::respGood(['status' => "OK", 'updated' => 512])], + [['article_ids' => "42, 2112, -1", 'field' => 3, 'mode' => 0], self::respGood(['status' => "OK", 'updated' => 512])], + [['article_ids' => "42, 2112, -1", 'field' => 3, 'mode' => 1], self::respGood(['status' => "OK", 'updated' => 512])], + [['article_ids' => "42, 2112, -1", 'field' => 3, 'mode' => 2], self::respGood(['status' => "OK", 'updated' => 512])], + [['article_ids' => "42, 2112, -1", 'field' => 3, 'mode' => 3], self::respGood(['status' => "OK", 'updated' => 512])], + [['article_ids' => "42, 2112, -1", 'field' => 3, 'data' => "eh"], self::respGood(['status' => "OK", 'updated' => 1024])], + [['article_ids' => "42, 2112, -1", 'field' => 4], self::respErr("INCORRECT_USAGE")], + [['article_ids' => "0, -1", 'field' => 3], self::respErr("INCORRECT_USAGE")], ]; } /** @dataProvider provideArticleListings */ public function testListArticles(array $in, ResponseInterface $exp): void { $in = array_merge(['op' => "getArticle", 'sid' => "PriestsOfSyrinx"], $in); - \Phake::when(Arsse::$db)->labelList($this->anything())->thenReturn(new Result($this->v($this->labels))); - \Phake::when(Arsse::$db)->labelList($this->anything(), false)->thenReturn(new Result($this->v($this->usedLabels))); + \Phake::when(Arsse::$db)->labelList($this->anything())->thenReturn(new Result(self::v($this->labels))); + \Phake::when(Arsse::$db)->labelList($this->anything(), false)->thenReturn(new Result(self::v($this->usedLabels))); \Phake::when(Arsse::$db)->articleLabelsGet($this->anything(), 101)->thenReturn([]); - \Phake::when(Arsse::$db)->articleLabelsGet($this->anything(), 102)->thenReturn($this->v([1,3])); - \Phake::when(Arsse::$db)->articleList($this->anything(), $this->equalTo((new Context)->articles([101, 102])), $this->anything())->thenReturn(new Result($this->v($this->articles))); - \Phake::when(Arsse::$db)->articleList($this->anything(), $this->equalTo((new Context)->articles([101])), $this->anything())->thenReturn(new Result($this->v([$this->articles[0]]))); - \Phake::when(Arsse::$db)->articleList($this->anything(), $this->equalTo((new Context)->articles([102])), $this->anything())->thenReturn(new Result($this->v([$this->articles[1]]))); + \Phake::when(Arsse::$db)->articleLabelsGet($this->anything(), 102)->thenReturn(self::v([1,3])); + \Phake::when(Arsse::$db)->articleList($this->anything(), $this->equalTo((new Context)->articles([101, 102])), $this->anything())->thenReturn(new Result(self::v($this->articles))); + \Phake::when(Arsse::$db)->articleList($this->anything(), $this->equalTo((new Context)->articles([101])), $this->anything())->thenReturn(new Result(self::v([$this->articles[0]]))); + \Phake::when(Arsse::$db)->articleList($this->anything(), $this->equalTo((new Context)->articles([102])), $this->anything())->thenReturn(new Result(self::v([$this->articles[1]]))); $this->assertMessage($exp, $this->req($in)); } - public function provideArticleListings(): iterable { + public static function provideArticleListings(): iterable { $exp = [ [ 'id' => "101", @@ -1475,13 +1475,13 @@ LONG_STRING; ], ]; return [ - [[], $this->respErr("INCORRECT_USAGE")], - [['article_id' => 0], $this->respErr("INCORRECT_USAGE")], - [['article_id' => -1], $this->respErr("INCORRECT_USAGE")], - [['article_id' => "0,-1"], $this->respErr("INCORRECT_USAGE")], - [['article_id' => "101,102"], $this->respGood($exp)], - [['article_id' => "101"], $this->respGood([$exp[0]])], - [['article_id' => "102"], $this->respGood([$exp[1]])], + [[], self::respErr("INCORRECT_USAGE")], + [['article_id' => 0], self::respErr("INCORRECT_USAGE")], + [['article_id' => -1], self::respErr("INCORRECT_USAGE")], + [['article_id' => "0,-1"], self::respErr("INCORRECT_USAGE")], + [['article_id' => "101,102"], self::respGood($exp)], + [['article_id' => "101"], self::respGood([$exp[0]])], + [['article_id' => "102"], self::respGood([$exp[1]])], ]; } @@ -1491,14 +1491,14 @@ LONG_STRING; \Phake::when(Arsse::$db)->labelList($this->anything())->thenReturn(new Result([])); \Phake::when(Arsse::$db)->labelList($this->anything(), false)->thenReturn(new Result([])); \Phake::when(Arsse::$db)->articleLabelsGet($this->anything(), 101)->thenReturn([]); - \Phake::when(Arsse::$db)->articleLabelsGet($this->anything(), 102)->thenReturn($this->v([1,3])); - \Phake::when(Arsse::$db)->articleList($this->anything(), $this->equalTo((new Context)->articles([101, 102])), $this->anything())->thenReturn(new Result($this->v($this->articles))); - \Phake::when(Arsse::$db)->articleList($this->anything(), $this->equalTo((new Context)->articles([101])), $this->anything())->thenReturn(new Result($this->v([$this->articles[0]]))); - \Phake::when(Arsse::$db)->articleList($this->anything(), $this->equalTo((new Context)->articles([102])), $this->anything())->thenReturn(new Result($this->v([$this->articles[1]]))); + \Phake::when(Arsse::$db)->articleLabelsGet($this->anything(), 102)->thenReturn(self::v([1,3])); + \Phake::when(Arsse::$db)->articleList($this->anything(), $this->equalTo((new Context)->articles([101, 102])), $this->anything())->thenReturn(new Result(self::v($this->articles))); + \Phake::when(Arsse::$db)->articleList($this->anything(), $this->equalTo((new Context)->articles([101])), $this->anything())->thenReturn(new Result(self::v([$this->articles[0]]))); + \Phake::when(Arsse::$db)->articleList($this->anything(), $this->equalTo((new Context)->articles([102])), $this->anything())->thenReturn(new Result(self::v([$this->articles[1]]))); $this->assertMessage($exp, $this->req($in)); } - public function provideArticleListingsWithoutLabels(): iterable { + public static function provideArticleListingsWithoutLabels(): iterable { $exp = [ [ 'id' => "101", @@ -1553,13 +1553,13 @@ LONG_STRING; ], ]; return [ - [[], $this->respErr("INCORRECT_USAGE")], - [['article_id' => 0], $this->respErr("INCORRECT_USAGE")], - [['article_id' => -1], $this->respErr("INCORRECT_USAGE")], - [['article_id' => "0,-1"], $this->respErr("INCORRECT_USAGE")], - [['article_id' => "101,102"], $this->respGood($exp)], - [['article_id' => "101"], $this->respGood([$exp[0]])], - [['article_id' => "102"], $this->respGood([$exp[1]])], + [[], self::respErr("INCORRECT_USAGE")], + [['article_id' => 0], self::respErr("INCORRECT_USAGE")], + [['article_id' => -1], self::respErr("INCORRECT_USAGE")], + [['article_id' => "0,-1"], self::respErr("INCORRECT_USAGE")], + [['article_id' => "101,102"], self::respGood($exp)], + [['article_id' => "101"], self::respGood([$exp[0]])], + [['article_id' => "102"], self::respGood([$exp[1]])], ]; } @@ -1569,48 +1569,48 @@ LONG_STRING; $in = array_merge($base, $in); $action = ($out instanceof \Exception) ? "thenThrow" : "thenReturn"; \Phake::when(Arsse::$obj)->get(\DateTimeImmutable::class)->thenReturn(new \DateTimeImmutable(self::NOW)); - \Phake::when(Arsse::$db)->labelList->thenReturn(new Result($this->v($this->labels))); - \Phake::when(Arsse::$db)->labelList($this->anything(), false)->thenReturn(new Result($this->v($this->usedLabels))); + \Phake::when(Arsse::$db)->labelList->thenReturn(new Result(self::v($this->labels))); + \Phake::when(Arsse::$db)->labelList($this->anything(), false)->thenReturn(new Result(self::v($this->usedLabels))); \Phake::when(Arsse::$db)->articleLabelsGet->thenReturn([]); - \Phake::when(Arsse::$db)->articleLabelsGet($this->anything(), 2112)->thenReturn($this->v([1,3])); + \Phake::when(Arsse::$db)->articleLabelsGet($this->anything(), 2112)->thenReturn(self::v([1,3])); \Phake::when(Arsse::$db)->articleCategoriesGet->thenReturn([]); \Phake::when(Arsse::$db)->articleCategoriesGet($this->anything(), 2112)->thenReturn(["Boring","Illogical"]); \Phake::when(Arsse::$db)->articleCount->thenReturn(2); \Phake::when(Arsse::$db)->articleList->$action($out); $this->assertMessage($exp, $this->req($in)); if ($out) { - \Phake::verify(Arsse::$db)->articleList($this->userId, $this->equalTo($c), $fields, $order); + \Phake::verify(Arsse::$db)->articleList(self::$userId, $this->equalTo($c), $fields, $order); } else { \Phake::verify(Arsse::$db, \Phake::never())->articleList(\Phake::anyParameters()); } } - public function provideHeadlines(): iterable { + public static function provideHeadlines(): iterable { $t = Date::normalize(self::NOW); $c = (new Context)->hidden(false)->limit(200); - $out = $this->generateHeadlines(47); + $out = self::generateHeadlines(47); $gone = new ExceptionInput("idMissing"); - $comp = new Result($this->v([['id' => 47], ['id' => 2112]])); - $expFull = $this->outputHeadlines(47); - $expComp = $this->respGood([['id' => 47], ['id' => 2112]]); + $comp = new Result(self::v([['id' => 47], ['id' => 2112]])); + $expFull = self::outputHeadlines(47); + $expComp = self::respGood([['id' => 47], ['id' => 2112]]); $fields = ["id", "guid", "title", "author", "url", "unread", "starred", "edited_date", "published_date", "subscription", "subscription_title", "note"]; $sort = ["edited_date desc"]; return [ - [true, [], null, $c, [], [], $this->respErr("INCORRECT_USAGE")], - [true, ['feed_id' => 0], null, $c, [], [], $this->respGood([])], + [true, [], null, $c, [], [], self::respErr("INCORRECT_USAGE")], + [true, ['feed_id' => 0], null, $c, [], [], self::respGood([])], [true, ['feed_id' => -1], $out, (clone $c)->starred(true), $fields, ["marked_date desc"], $expFull], - [true, ['feed_id' => -2], null, $c, [], [], $this->respGood([])], + [true, ['feed_id' => -2], null, $c, [], [], self::respGood([])], [true, ['feed_id' => -4], $out, $c, $fields, $sort, $expFull], - [true, ['feed_id' => 2112], $gone, (clone $c)->subscription(2112), $fields, $sort, $this->respGood([])], + [true, ['feed_id' => 2112], $gone, (clone $c)->subscription(2112), $fields, $sort, self::respGood([])], [true, ['feed_id' => -2112], $out, (clone $c)->label(1088), $fields, $sort, $expFull], [true, ['feed_id' => -4, 'view_mode' => "adaptive"], $out, (clone $c)->unread(true), $fields, $sort, $expFull], - [true, ['feed_id' => -4, 'view_mode' => "published"], null, $c, [], [], $this->respGood([])], + [true, ['feed_id' => -4, 'view_mode' => "published"], null, $c, [], [], self::respGood([])], [true, ['feed_id' => -2112, 'view_mode' => "adaptive"], $out, (clone $c)->label(1088)->unread(true), $fields, $sort, $expFull], [true, ['feed_id' => -2112, 'view_mode' => "unread"], $out, (clone $c)->label(1088)->unread(true), $fields, $sort, $expFull], [true, ['feed_id' => 42, 'view_mode' => "marked"], $out, (clone $c)->subscription(42)->starred(true), $fields, $sort, $expFull], [true, ['feed_id' => 42, 'view_mode' => "has_note"], $out, (clone $c)->subscription(42)->annotated(true), $fields, $sort, $expFull], - [true, ['feed_id' => 42, 'view_mode' => "unread", 'search' => "unread:false"], null, $c, [], [], $this->respGood([])], - [true, ['feed_id' => 42, 'search' => "pub:true"], null, $c, [], [], $this->respGood([])], + [true, ['feed_id' => 42, 'view_mode' => "unread", 'search' => "unread:false"], null, $c, [], [], self::respGood([])], + [true, ['feed_id' => 42, 'search' => "pub:true"], null, $c, [], [], self::respGood([])], [true, ['feed_id' => -4, 'limit' => 5], $out, (clone $c)->limit(5), $fields, $sort, $expFull], [true, ['feed_id' => -4, 'skip' => 2], $out, (clone $c)->offset(2), $fields, $sort, $expFull], [true, ['feed_id' => -4, 'limit' => 5, 'skip' => 2], $out, (clone $c)->limit(5)->offset(2), $fields, $sort, $expFull], @@ -1618,7 +1618,7 @@ LONG_STRING; [true, ['feed_id' => -3, 'is_cat' => true], $out, $c, $fields, $sort, $expFull], [true, ['feed_id' => -4, 'is_cat' => true], $out, $c, $fields, $sort, $expFull], [true, ['feed_id' => -2, 'is_cat' => true], $out, (clone $c)->labelled(true), $fields, $sort, $expFull], - [true, ['feed_id' => -1, 'is_cat' => true], null, $c, [], [], $this->respGood([])], + [true, ['feed_id' => -1, 'is_cat' => true], null, $c, [], [], self::respGood([])], [true, ['feed_id' => 0, 'is_cat' => true], $out, (clone $c)->folderShallow(0), $fields, $sort, $expFull], [true, ['feed_id' => 0, 'is_cat' => true, 'include_nested' => true], $out, (clone $c)->folderShallow(0), $fields, $sort, $expFull], [true, ['feed_id' => 42, 'is_cat' => true], $out, (clone $c)->folderShallow(42), $fields, $sort, $expFull], @@ -1627,18 +1627,18 @@ LONG_STRING; [true, ['feed_id' => -4, 'order_by' => "date_reverse"], $out, $c, $fields, ["edited_date"], $expFull], [true, ['feed_id' => 42, 'search' => "interesting"], $out, (clone $c)->subscription(42)->searchTerms(["interesting"]), $fields, $sort, $expFull], [true, ['feed_id' => -6], $out, (clone $c)->unread(false)->markedRange(Date::sub("PT24H", $t), null), $fields, ["marked_date desc"], $expFull], - [true, ['feed_id' => -6, 'view_mode' => "unread"], null, $c, $fields, $sort, $this->respGood([])], + [true, ['feed_id' => -6, 'view_mode' => "unread"], null, $c, $fields, $sort, self::respGood([])], [true, ['feed_id' => -3], $out, (clone $c)->unread(true)->modifiedRange(Date::sub("PT24H", $t), null), $fields, $sort, $expFull], [true, ['feed_id' => -3, 'view_mode' => "marked"], $out, (clone $c)->unread(true)->starred(true)->modifiedRange(Date::sub("PT24H", $t), null), $fields, $sort, $expFull], - [false, [], null, (clone $c)->limit(null), [], [], $this->respErr("INCORRECT_USAGE")], - [false, ['feed_id' => 0], null, (clone $c)->limit(null), [], [], $this->respGood([])], + [false, [], null, (clone $c)->limit(null), [], [], self::respErr("INCORRECT_USAGE")], + [false, ['feed_id' => 0], null, (clone $c)->limit(null), [], [], self::respGood([])], [false, ['feed_id' => -1], $comp, (clone $c)->limit(null)->starred(true), ["id"], ["marked_date desc"], $expComp], - [false, ['feed_id' => -2], null, (clone $c)->limit(null), [], [], $this->respGood([])], + [false, ['feed_id' => -2], null, (clone $c)->limit(null), [], [], self::respGood([])], [false, ['feed_id' => -4], $comp, (clone $c)->limit(null), ["id"], $sort, $expComp], - [false, ['feed_id' => 2112], $gone, (clone $c)->limit(null)->subscription(2112), ["id"], $sort, $this->respGood([])], + [false, ['feed_id' => 2112], $gone, (clone $c)->limit(null)->subscription(2112), ["id"], $sort, self::respGood([])], [false, ['feed_id' => -2112], $comp, (clone $c)->limit(null)->label(1088), ["id"], $sort, $expComp], [false, ['feed_id' => -4, 'view_mode' => "adaptive"], $comp, (clone $c)->limit(null)->unread(true), ["id"], $sort, $expComp], - [false, ['feed_id' => -4, 'view_mode' => "published"], null, (clone $c)->limit(null), [], [], $this->respGood([])], + [false, ['feed_id' => -4, 'view_mode' => "published"], null, (clone $c)->limit(null), [], [], self::respGood([])], [false, ['feed_id' => -2112, 'view_mode' => "adaptive"], $comp, (clone $c)->limit(null)->label(1088)->unread(true), ["id"], $sort, $expComp], [false, ['feed_id' => -2112, 'view_mode' => "unread"], $comp, (clone $c)->limit(null)->label(1088)->unread(true), ["id"], $sort, $expComp], [false, ['feed_id' => 42, 'view_mode' => "marked"], $comp, (clone $c)->limit(null)->subscription(42)->starred(true), ["id"], $sort, $expComp], @@ -1648,7 +1648,7 @@ LONG_STRING; [false, ['feed_id' => -4, 'limit' => 5, 'skip' => 2], $comp, (clone $c)->limit(5)->offset(2), ["id"], $sort, $expComp], [false, ['feed_id' => -4, 'since_id' => 47], $comp, (clone $c)->limit(null)->articleRange(48, null), ["id"], $sort, $expComp], [false, ['feed_id' => -6], $comp, (clone $c)->limit(null)->unread(false)->markedRange(Date::sub("PT24H", $t), null), ["id"], ["marked_date desc"], $expComp], - [false, ['feed_id' => -6, 'view_mode' => "unread"], null, (clone $c)->limit(null), ["id"], $sort, $this->respGood([])], + [false, ['feed_id' => -6, 'view_mode' => "unread"], null, (clone $c)->limit(null), ["id"], $sort, self::respGood([])], [false, ['feed_id' => -3], $comp, (clone $c)->limit(null)->unread(true)->modifiedRange(Date::sub("PT24H", $t), null), ["id"], $sort, $expComp], [false, ['feed_id' => -3, 'view_mode' => "marked"], $comp, (clone $c)->limit(null)->unread(true)->starred(true)->modifiedRange(Date::sub("PT24H", $t), null), ["id"], $sort, $expComp], ]; @@ -1669,23 +1669,23 @@ LONG_STRING; ['op' => "getHeadlines", 'sid' => "PriestsOfSyrinx", 'feed_id' => 42, 'skip' => 47, 'include_header' => true, 'order_by' => "date_reverse"], ['op' => "getHeadlines", 'sid' => "PriestsOfSyrinx", 'feed_id' => -4, 'show_excerpt' => true], ]; - \Phake::when(Arsse::$db)->labelList($this->anything())->thenReturn(new Result($this->v($this->labels))); - \Phake::when(Arsse::$db)->labelList($this->anything(), false)->thenReturn(new Result($this->v($this->usedLabels))); + \Phake::when(Arsse::$db)->labelList($this->anything())->thenReturn(new Result(self::v($this->labels))); + \Phake::when(Arsse::$db)->labelList($this->anything(), false)->thenReturn(new Result(self::v($this->usedLabels))); \Phake::when(Arsse::$db)->articleLabelsGet->thenReturn([]); - \Phake::when(Arsse::$db)->articleLabelsGet($this->anything(), 2112)->thenReturn($this->v([1,3])); + \Phake::when(Arsse::$db)->articleLabelsGet($this->anything(), 2112)->thenReturn(self::v([1,3])); \Phake::when(Arsse::$db)->articleCategoriesGet->thenReturn([]); \Phake::when(Arsse::$db)->articleCategoriesGet($this->anything(), 2112)->thenReturn(["Boring","Illogical"]); - \Phake::when(Arsse::$db)->articleList->thenReturn($this->generateHeadlines(1)); + \Phake::when(Arsse::$db)->articleList->thenReturn(self::generateHeadlines(1)); \Phake::when(Arsse::$db)->articleCount->thenReturn(0); \Phake::when(Arsse::$db)->articleCount($this->anything(), $this->equalTo((new Context)->unread(true)->hidden(false)))->thenReturn(1); // sanity check; this makes sure extra fields are not included in default situations $test = $this->req($in[0]); - $this->assertMessage($this->outputHeadlines(1), $test); + $this->assertMessage(self::outputHeadlines(1), $test); // test 'show_content' $test = $this->req($in[1]); $this->assertArrayHasKey("content", $this->extractMessageJson($test)['content'][0]); $this->assertArrayHasKey("content", $this->extractMessageJson($test)['content'][1]); - foreach ($this->generateHeadlines(1) as $key => $row) { + foreach (self::generateHeadlines(1) as $key => $row) { $this->assertSame($row['content'], $this->extractMessageJson($test)['content'][$key]['content']); } // test 'include_attachments' @@ -1708,21 +1708,21 @@ LONG_STRING; $this->assertSame($exp, $this->extractMessageJson($test)['content'][1]['attachments']); // test 'include_header' $test = $this->req($in[3]); - $exp = $this->respGood([ + $exp = self::respGood([ ['id' => -4, 'is_cat' => false, 'first_id' => 1], - $this->extractMessageJson($this->outputHeadlines(1))['content'], + $this->extractMessageJson(self::outputHeadlines(1))['content'], ]); $this->assertMessage($exp, $test); // test 'include_header' with a category $test = $this->req($in[4]); - $exp = $this->respGood([ + $exp = self::respGood([ ['id' => -3, 'is_cat' => true, 'first_id' => 1], - $this->extractMessageJson($this->outputHeadlines(1))['content'], + $this->extractMessageJson(self::outputHeadlines(1))['content'], ]); $this->assertMessage($exp, $test); // test 'include_header' with an empty result $test = $this->req($in[5]); - $exp = $this->respGood([ + $exp = self::respGood([ ['id' => -1, 'is_cat' => true, 'first_id' => 0], [], ]); @@ -1730,31 +1730,31 @@ LONG_STRING; // test 'include_header' with an erroneous result \Phake::when(Arsse::$db)->articleList($this->anything(), $this->equalTo((new Context)->limit(200)->subscription(2112)->hidden(false)), $this->anything(), ["edited_date desc"])->thenThrow(new ExceptionInput("subjectMissing")); $test = $this->req($in[6]); - $exp = $this->respGood([ + $exp = self::respGood([ ['id' => 2112, 'is_cat' => false, 'first_id' => 0], [], ]); $this->assertMessage($exp, $test); // test 'include_header' with ascending order $test = $this->req($in[7]); - $exp = $this->respGood([ + $exp = self::respGood([ ['id' => -4, 'is_cat' => false, 'first_id' => 0], - $this->extractMessageJson($this->outputHeadlines(1))['content'], + $this->extractMessageJson(self::outputHeadlines(1))['content'], ]); $this->assertMessage($exp, $test); // test 'include_header' with skip - \Phake::when(Arsse::$db)->articleList($this->anything(), $this->equalTo((new Context)->limit(1)->subscription(42)->hidden(false)), $this->anything(), ["edited_date desc"])->thenReturn($this->generateHeadlines(1867)); + \Phake::when(Arsse::$db)->articleList($this->anything(), $this->equalTo((new Context)->limit(1)->subscription(42)->hidden(false)), $this->anything(), ["edited_date desc"])->thenReturn(self::generateHeadlines(1867)); $test = $this->req($in[8]); - $exp = $this->respGood([ + $exp = self::respGood([ ['id' => 42, 'is_cat' => false, 'first_id' => 1867], - $this->extractMessageJson($this->outputHeadlines(1))['content'], + $this->extractMessageJson(self::outputHeadlines(1))['content'], ]); $this->assertMessage($exp, $test); // test 'include_header' with skip and ascending order $test = $this->req($in[9]); - $exp = $this->respGood([ + $exp = self::respGood([ ['id' => 42, 'is_cat' => false, 'first_id' => 0], - $this->extractMessageJson($this->outputHeadlines(1))['content'], + $this->extractMessageJson(self::outputHeadlines(1))['content'], ]); $this->assertMessage($exp, $test); // test 'show_excerpt' @@ -1767,8 +1767,8 @@ LONG_STRING; $this->assertSame($exp2, $this->extractMessageJson($test)['content'][1]['excerpt']); } - protected function generateHeadlines(int $id): Result { - return new Result($this->v([ + protected static function generateHeadlines(int $id): Result { + return new Result(self::v([ [ 'id' => $id, 'url' => 'http://example.com/1', @@ -1795,7 +1795,7 @@ LONG_STRING; 'title' => 'Article title 2', 'subscription_title' => "Feed 11", 'author' => 'J. King', - 'content' => $this->richContent, + 'content' => self::$richContent, 'guid' => '5be8a5a46ecd52ed132191c8d27fb1af6b3d4edc00234c5d9f8f0e10562ed3b7', 'published_date' => '2000-01-02 00:00:00', 'edited_date' => '2000-01-02 00:00:02', @@ -1812,8 +1812,8 @@ LONG_STRING; ])); } - protected function outputHeadlines(int $id): ResponseInterface { - return $this->respGood([ + protected static function outputHeadlines(int $id): ResponseInterface { + return self::respGood([ [ 'id' => $id, 'guid' => '', diff --git a/tests/cases/REST/TinyTinyRSS/TestSearch.php b/tests/cases/REST/TinyTinyRSS/TestSearch.php index 23a51693..3c95ef84 100644 --- a/tests/cases/REST/TinyTinyRSS/TestSearch.php +++ b/tests/cases/REST/TinyTinyRSS/TestSearch.php @@ -12,7 +12,7 @@ use JKingWeb\Arsse\REST\TinyTinyRSS\Search; /** @covers \JKingWeb\Arsse\REST\TinyTinyRSS\Search */ class TestSearch extends \JKingWeb\Arsse\Test\AbstractTest { - public function provideSearchStrings(): iterable { + public static function provideSearchStrings(): iterable { return [ 'Blank string' => ["", new Context], 'Whitespace only' => [" \n \t", new Context], diff --git a/tests/cases/Service/TestDaemon.php b/tests/cases/Service/TestDaemon.php index afc0374f..cace0aa7 100644 --- a/tests/cases/Service/TestDaemon.php +++ b/tests/cases/Service/TestDaemon.php @@ -56,7 +56,7 @@ class TestDaemon extends \JKingWeb\Arsse\Test\AbstractTest { $this->AssertSame($exp, $daemon->resolveRelativePath($path)); } - public function providePathResolutions(): iterable { + public static function providePathResolutions(): iterable { return [ ["/", "/home/me", "/"], ["/.", "/home/me", "/"], @@ -94,7 +94,7 @@ class TestDaemon extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function providePidFileChecks(): iterable { + public static function providePidFileChecks(): iterable { return [ ["ok/file", false, new Exception("pidDirUnresolvable")], ["not/found", true, new Exception("pidDirMissing")], @@ -136,7 +136,7 @@ class TestDaemon extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function providePidReadChecks(): iterable { + public static function providePidReadChecks(): iterable { return [ ["current", new Exception("pidDuplicate")], ["malformed1", new Exception("pidCorrupt")], @@ -190,7 +190,7 @@ class TestDaemon extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function providePidWriteChecks(): iterable { + public static function providePidWriteChecks(): iterable { return [ ["current", new Exception("pidDuplicate")], ["malformed1", new Exception("pidCorrupt")], diff --git a/tests/cases/TestArsse.php b/tests/cases/TestArsse.php index 151b26ff..2ca5afee 100644 --- a/tests/cases/TestArsse.php +++ b/tests/cases/TestArsse.php @@ -56,7 +56,7 @@ class TestArsse extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function provideExtensionChecks(): iterable { + public static function provideExtensionChecks(): iterable { return [ [["pcre"], null], [["foo", "bar", "baz"], new Exception("extMissing", ['first' => "foo", 'total' => 3])], diff --git a/tests/cases/User/TestInternal.php b/tests/cases/User/TestInternal.php index ce19849c..04570525 100644 --- a/tests/cases/User/TestInternal.php +++ b/tests/cases/User/TestInternal.php @@ -46,7 +46,7 @@ class TestInternal extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame($exp, $this->d->auth($user, $password)); } - public function provideAuthentication(): iterable { + public static function provideAuthentication(): iterable { $john = "john.doe@example.com"; $jane = "jane.doe@example.com"; $owen = "owen.hardy@example.com"; diff --git a/tests/cases/User/TestUser.php b/tests/cases/User/TestUser.php index 02db8089..5a1be7d5 100644 --- a/tests/cases/User/TestUser.php +++ b/tests/cases/User/TestUser.php @@ -71,7 +71,7 @@ class TestUser extends \JKingWeb\Arsse\Test\AbstractTest { \Phake::verify(Arsse::$db, \Phake::times($exp && $user === "jane.doe@example.com" ? 1 : 0))->userAdd($user, $password); } - public function provideAuthentication(): iterable { + public static function provideAuthentication(): iterable { $john = "john.doe@example.com"; $jane = "jane.doe@example.com"; return [ @@ -163,7 +163,7 @@ class TestUser extends \JKingWeb\Arsse\Test\AbstractTest { $u->add($user, "secret"); } - public function provideInvalidUserNames(): iterable { + public static function provideInvalidUserNames(): iterable { // output names with control characters foreach (array_merge(range(0x00, 0x1F), [0x7F]) as $ord) { yield [chr($ord)]; @@ -419,7 +419,7 @@ class TestUser extends \JKingWeb\Arsse\Test\AbstractTest { \Phake::verify(Arsse::$db)->userExists($user); } - public function provideProperties(): iterable { + public static function provideProperties(): iterable { $defaults = ['num' => 1, 'admin' => false, 'lang' => null, 'tz' => "Etc/UTC", 'sort_asc' => false]; return [ [$defaults, $defaults, []], @@ -499,7 +499,7 @@ class TestUser extends \JKingWeb\Arsse\Test\AbstractTest { } } - public function providePropertyChanges(): iterable { + public static function providePropertyChanges(): iterable { return [ [['admin' => true], ['admin' => true]], [['admin' => 2], new ExceptionInput("invalidValue")], diff --git a/tests/lib/AbstractTest.php b/tests/lib/AbstractTest.php index 19b31291..27f27585 100644 --- a/tests/lib/AbstractTest.php +++ b/tests/lib/AbstractTest.php @@ -27,8 +27,6 @@ use GuzzleHttp\Psr7\ServerRequest; /** @coversNothing */ abstract class AbstractTest extends \PHPUnit\Framework\TestCase { - use \DMS\PHPUnitExtensions\ArraySubset\ArraySubsetAsserts; - public function setUp(): void { self::clearData(); // create the object factory as a mock @@ -133,19 +131,24 @@ abstract class AbstractTest extends \PHPUnit\Framework\TestCase { return $req; } - public static function assertMatchesRegularExpression(string $pattern, string $string, string $message = ''): void { - if (method_exists(parent::class, "assertMatchesRegularExpression")) { - parent::assertMatchesRegularExpression($pattern, $string, $message); + public function assertArraySubset($expected, $actual, string $message = ''): void { + $this->assertIsArray($actual); + if (array_is_list($expected)) { + $missing = $actual; + $actual = []; + foreach ($expected as $k => $v) { + $found = array_search($v, $missing, true); + if ($found !== false) { + $actual[$k] = $missing[$found]; + unset($missing[$found]); + } + } + $this->assertEquals($expected, $actual, $message ?: "Array subset does not match expectation."); } else { - parent::assertRegExp($pattern, $string, $message); - } - } - - public static function assertFileDoesNotExist(string $filename, string $message = ''): void { - if (method_exists(parent::class, "assertFileDoesNotExist")) { - parent::assertFileDoesNotExist($filename, $message); - } else { - parent::assertFileNotExists($filename, $message); + $actual = array_intersect_key($actual, $expected); + ksort($actual); + ksort($expected); + $this->assertEquals($expected, $actual, $message ?: "Array subset does not match expectation."); } } @@ -344,7 +347,7 @@ abstract class AbstractTest extends \PHPUnit\Framework\TestCase { $data = $this->stringify($data); } } - $this->assertCount(sizeof($expected), $data, "Number of result rows (".sizeof($data).") differs from number of expected rows (".sizeof($expected).")"); + $this->assertSameSize($expected, $data, "Number of result rows (".sizeof($data).") differs from number of expected rows (".sizeof($expected).")"); if (sizeof($expected)) { // make sure the expectations are consistent foreach ($expected as $exp) { @@ -372,7 +375,7 @@ abstract class AbstractTest extends \PHPUnit\Framework\TestCase { $found = array_search($row, $expected); unset($expected[$found]); } - $this->assertArraySubset($expected, [], false, "Expectations not in result set."); + $this->assertEmpty($expected, "Expectations not in result set."); } } diff --git a/tests/lib/PDOTest.php b/tests/lib/PDOTest.php index f0d6621c..e33ccad4 100644 --- a/tests/lib/PDOTest.php +++ b/tests/lib/PDOTest.php @@ -8,13 +8,13 @@ declare(strict_types=1); namespace JKingWeb\Arsse\Test; trait PDOTest { - protected function v($value) { + protected static function v($value) { if (!is_array($value)) { return $value; } foreach ($value as $k => $v) { if (is_array($v)) { - $value[$k] = $this->v($v); + $value[$k] = self::v($v); } elseif (is_int($v) || is_float($v)) { $value[$k] = (string) $v; } diff --git a/vendor-bin/phpunit/composer.json b/vendor-bin/phpunit/composer.json index 12aedb29..5aa1a084 100644 --- a/vendor-bin/phpunit/composer.json +++ b/vendor-bin/phpunit/composer.json @@ -1,10 +1,9 @@ { "require-dev": { - "phpunit/phpunit": "^9.0", - "dms/phpunit-arraysubset-asserts": "^0.1 || ^0.2", + "phpunit/phpunit": "^11.0", "clue/arguments": "^2.0", "mikey179/vfsstream": "^1.6", "webmozart/glob": "^4.1", - "phake/phake": "^4.4 | ^3.1.9" + "phake/phake": "^4.4" } } diff --git a/vendor-bin/phpunit/composer.lock b/vendor-bin/phpunit/composer.lock index f448d73d..5dbe0074 100644 --- a/vendor-bin/phpunit/composer.lock +++ b/vendor-bin/phpunit/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "428806f4a006a89c0f7044ca6a635eaa", + "content-hash": "102d2fd932931255fb7b9b247bfb4d91", "packages": [], "packages-dev": [ { @@ -74,51 +74,6 @@ ], "time": "2020-12-08T13:02:50+00:00" }, - { - "name": "dms/phpunit-arraysubset-asserts", - "version": "v0.2.1", - "source": { - "type": "git", - "url": "https://github.com/rdohms/phpunit-arraysubset-asserts.git", - "reference": "8e3673a70019a60df484e36fc3271d63cbdc40ea" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/rdohms/phpunit-arraysubset-asserts/zipball/8e3673a70019a60df484e36fc3271d63cbdc40ea", - "reference": "8e3673a70019a60df484e36fc3271d63cbdc40ea", - "shasum": "" - }, - "require": { - "php": "^7.3|^8.0", - "phpunit/phpunit": "^9.0" - }, - "require-dev": { - "dms/coding-standard": "^1.0", - "squizlabs/php_codesniffer": "^3.4" - }, - "type": "library", - "autoload": { - "psr-4": { - "DMS\\PHPUnitExtensions\\ArraySubset\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Rafael Dohms", - "email": "rdohms@gmail.com" - } - ], - "description": "This package provides ArraySubset and related asserts once deprecated in PHPUnit 8", - "support": { - "issues": "https://github.com/rdohms/phpunit-arraysubset-asserts/issues", - "source": "https://github.com/rdohms/phpunit-arraysubset-asserts/tree/v0.2.1" - }, - "time": "2020-10-03T21:43:40+00:00" - }, { "name": "doctrine/instantiator", "version": "1.5.0", @@ -550,35 +505,35 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.32", + "version": "11.0.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "85402a822d1ecf1db1096959413d35e1c37cf1a5" + "reference": "418c59fd080954f8c4aa5631d9502ecda2387118" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/85402a822d1ecf1db1096959413d35e1c37cf1a5", - "reference": "85402a822d1ecf1db1096959413d35e1c37cf1a5", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/418c59fd080954f8c4aa5631d9502ecda2387118", + "reference": "418c59fd080954f8c4aa5631d9502ecda2387118", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.19.1 || ^5.1.0", - "php": ">=7.3", - "phpunit/php-file-iterator": "^3.0.6", - "phpunit/php-text-template": "^2.0.4", - "sebastian/code-unit-reverse-lookup": "^2.0.3", - "sebastian/complexity": "^2.0.3", - "sebastian/environment": "^5.1.5", - "sebastian/lines-of-code": "^1.0.4", - "sebastian/version": "^3.0.2", + "nikic/php-parser": "^5.3.1", + "php": ">=8.2", + "phpunit/php-file-iterator": "^5.1.0", + "phpunit/php-text-template": "^4.0.1", + "sebastian/code-unit-reverse-lookup": "^4.0.1", + "sebastian/complexity": "^4.0.1", + "sebastian/environment": "^7.2.0", + "sebastian/lines-of-code": "^3.0.1", + "sebastian/version": "^5.0.2", "theseer/tokenizer": "^1.2.3" }, "require-dev": { - "phpunit/phpunit": "^9.6" + "phpunit/phpunit": "^11.5.0" }, "suggest": { "ext-pcov": "PHP extension that provides line coverage", @@ -587,7 +542,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "9.2.x-dev" + "dev-main": "11.0.x-dev" } }, "autoload": { @@ -616,7 +571,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.32" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/11.0.8" }, "funding": [ { @@ -624,32 +579,32 @@ "type": "github" } ], - "time": "2024-08-22T04:23:01+00:00" + "time": "2024-12-11T12:34:27+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "3.0.6", + "version": "5.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf" + "reference": "118cfaaa8bc5aef3287bf315b6060b1174754af6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", - "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/118cfaaa8bc5aef3287bf315b6060b1174754af6", + "reference": "118cfaaa8bc5aef3287bf315b6060b1174754af6", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -676,7 +631,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6" + "security": "https://github.com/sebastianbergmann/php-file-iterator/security/policy", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/5.1.0" }, "funding": [ { @@ -684,28 +640,28 @@ "type": "github" } ], - "time": "2021-12-02T12:48:52+00:00" + "time": "2024-08-27T05:02:59+00:00" }, { "name": "phpunit/php-invoker", - "version": "3.1.1", + "version": "5.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-invoker.git", - "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67" + "reference": "c1ca3814734c07492b3d4c5f794f4b0995333da2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67", - "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/c1ca3814734c07492b3d4c5f794f4b0995333da2", + "reference": "c1ca3814734c07492b3d4c5f794f4b0995333da2", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { "ext-pcntl": "*", - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "suggest": { "ext-pcntl": "*" @@ -713,7 +669,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -739,7 +695,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-invoker/issues", - "source": "https://github.com/sebastianbergmann/php-invoker/tree/3.1.1" + "security": "https://github.com/sebastianbergmann/php-invoker/security/policy", + "source": "https://github.com/sebastianbergmann/php-invoker/tree/5.0.1" }, "funding": [ { @@ -747,32 +704,32 @@ "type": "github" } ], - "time": "2020-09-28T05:58:55+00:00" + "time": "2024-07-03T05:07:44+00:00" }, { "name": "phpunit/php-text-template", - "version": "2.0.4", + "version": "4.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28" + "reference": "3e0404dc6b300e6bf56415467ebcb3fe4f33e964" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", - "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/3e0404dc6b300e6bf56415467ebcb3fe4f33e964", + "reference": "3e0404dc6b300e6bf56415467ebcb3fe4f33e964", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -798,7 +755,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-text-template/issues", - "source": "https://github.com/sebastianbergmann/php-text-template/tree/2.0.4" + "security": "https://github.com/sebastianbergmann/php-text-template/security/policy", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/4.0.1" }, "funding": [ { @@ -806,32 +764,32 @@ "type": "github" } ], - "time": "2020-10-26T05:33:50+00:00" + "time": "2024-07-03T05:08:43+00:00" }, { "name": "phpunit/php-timer", - "version": "5.0.3", + "version": "7.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2" + "reference": "3b415def83fbcb41f991d9ebf16ae4ad8b7837b3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", - "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3b415def83fbcb41f991d9ebf16ae4ad8b7837b3", + "reference": "3b415def83fbcb41f991d9ebf16ae4ad8b7837b3", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-main": "7.0-dev" } }, "autoload": { @@ -857,7 +815,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-timer/issues", - "source": "https://github.com/sebastianbergmann/php-timer/tree/5.0.3" + "security": "https://github.com/sebastianbergmann/php-timer/security/policy", + "source": "https://github.com/sebastianbergmann/php-timer/tree/7.0.1" }, "funding": [ { @@ -865,24 +824,23 @@ "type": "github" } ], - "time": "2020-10-26T13:16:10+00:00" + "time": "2024-07-03T05:09:35+00:00" }, { "name": "phpunit/phpunit", - "version": "9.6.22", + "version": "11.5.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "f80235cb4d3caa59ae09be3adf1ded27521d1a9c" + "reference": "153d0531b9f7e883c5053160cad6dd5ac28140b3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f80235cb4d3caa59ae09be3adf1ded27521d1a9c", - "reference": "f80235cb4d3caa59ae09be3adf1ded27521d1a9c", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/153d0531b9f7e883c5053160cad6dd5ac28140b3", + "reference": "153d0531b9f7e883c5053160cad6dd5ac28140b3", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.5.0 || ^2", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", @@ -892,27 +850,26 @@ "myclabs/deep-copy": "^1.12.1", "phar-io/manifest": "^2.0.4", "phar-io/version": "^3.2.1", - "php": ">=7.3", - "phpunit/php-code-coverage": "^9.2.32", - "phpunit/php-file-iterator": "^3.0.6", - "phpunit/php-invoker": "^3.1.1", - "phpunit/php-text-template": "^2.0.4", - "phpunit/php-timer": "^5.0.3", - "sebastian/cli-parser": "^1.0.2", - "sebastian/code-unit": "^1.0.8", - "sebastian/comparator": "^4.0.8", - "sebastian/diff": "^4.0.6", - "sebastian/environment": "^5.1.5", - "sebastian/exporter": "^4.0.6", - "sebastian/global-state": "^5.0.7", - "sebastian/object-enumerator": "^4.0.4", - "sebastian/resource-operations": "^3.0.4", - "sebastian/type": "^3.2.1", - "sebastian/version": "^3.0.2" + "php": ">=8.2", + "phpunit/php-code-coverage": "^11.0.8", + "phpunit/php-file-iterator": "^5.1.0", + "phpunit/php-invoker": "^5.0.1", + "phpunit/php-text-template": "^4.0.1", + "phpunit/php-timer": "^7.0.1", + "sebastian/cli-parser": "^3.0.2", + "sebastian/code-unit": "^3.0.2", + "sebastian/comparator": "^6.2.1", + "sebastian/diff": "^6.0.2", + "sebastian/environment": "^7.2.0", + "sebastian/exporter": "^6.3.0", + "sebastian/global-state": "^7.0.2", + "sebastian/object-enumerator": "^6.0.1", + "sebastian/type": "^5.1.0", + "sebastian/version": "^5.0.2", + "staabm/side-effects-detector": "^1.0.5" }, "suggest": { - "ext-soap": "To be able to generate mocks based on WSDL files", - "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" + "ext-soap": "To be able to generate mocks based on WSDL files" }, "bin": [ "phpunit" @@ -920,7 +877,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "9.6-dev" + "dev-main": "11.5-dev" } }, "autoload": { @@ -952,7 +909,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.22" + "source": "https://github.com/sebastianbergmann/phpunit/tree/11.5.2" }, "funding": [ { @@ -968,32 +925,32 @@ "type": "tidelift" } ], - "time": "2024-12-05T13:48:26+00:00" + "time": "2024-12-21T05:51:08+00:00" }, { "name": "sebastian/cli-parser", - "version": "1.0.2", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/cli-parser.git", - "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b" + "reference": "15c5dd40dc4f38794d383bb95465193f5e0ae180" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/2b56bea83a09de3ac06bb18b92f068e60cc6f50b", - "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/15c5dd40dc4f38794d383bb95465193f5e0ae180", + "reference": "15c5dd40dc4f38794d383bb95465193f5e0ae180", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -1016,7 +973,8 @@ "homepage": "https://github.com/sebastianbergmann/cli-parser", "support": { "issues": "https://github.com/sebastianbergmann/cli-parser/issues", - "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.2" + "security": "https://github.com/sebastianbergmann/cli-parser/security/policy", + "source": "https://github.com/sebastianbergmann/cli-parser/tree/3.0.2" }, "funding": [ { @@ -1024,32 +982,32 @@ "type": "github" } ], - "time": "2024-03-02T06:27:43+00:00" + "time": "2024-07-03T04:41:36+00:00" }, { "name": "sebastian/code-unit", - "version": "1.0.8", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit.git", - "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120" + "reference": "ee88b0cdbe74cf8dd3b54940ff17643c0d6543ca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/1fc9f64c0927627ef78ba436c9b17d967e68e120", - "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/ee88b0cdbe74cf8dd3b54940ff17643c0d6543ca", + "reference": "ee88b0cdbe74cf8dd3b54940ff17643c0d6543ca", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -1072,7 +1030,8 @@ "homepage": "https://github.com/sebastianbergmann/code-unit", "support": { "issues": "https://github.com/sebastianbergmann/code-unit/issues", - "source": "https://github.com/sebastianbergmann/code-unit/tree/1.0.8" + "security": "https://github.com/sebastianbergmann/code-unit/security/policy", + "source": "https://github.com/sebastianbergmann/code-unit/tree/3.0.2" }, "funding": [ { @@ -1080,32 +1039,32 @@ "type": "github" } ], - "time": "2020-10-26T13:08:54+00:00" + "time": "2024-12-12T09:59:06+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", - "version": "2.0.3", + "version": "4.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5" + "reference": "183a9b2632194febd219bb9246eee421dad8d45e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", - "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/183a9b2632194febd219bb9246eee421dad8d45e", + "reference": "183a9b2632194febd219bb9246eee421dad8d45e", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -1127,7 +1086,8 @@ "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", "support": { "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", - "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/2.0.3" + "security": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/security/policy", + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/4.0.1" }, "funding": [ { @@ -1135,34 +1095,36 @@ "type": "github" } ], - "time": "2020-09-28T05:30:19+00:00" + "time": "2024-07-03T04:45:54+00:00" }, { "name": "sebastian/comparator", - "version": "4.0.8", + "version": "6.2.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "fa0f136dd2334583309d32b62544682ee972b51a" + "reference": "43d129d6a0f81c78bee378b46688293eb7ea3739" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa0f136dd2334583309d32b62544682ee972b51a", - "reference": "fa0f136dd2334583309d32b62544682ee972b51a", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/43d129d6a0f81c78bee378b46688293eb7ea3739", + "reference": "43d129d6a0f81c78bee378b46688293eb7ea3739", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/diff": "^4.0", - "sebastian/exporter": "^4.0" + "ext-dom": "*", + "ext-mbstring": "*", + "php": ">=8.2", + "sebastian/diff": "^6.0", + "sebastian/exporter": "^6.0" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "6.2-dev" } }, "autoload": { @@ -1201,7 +1163,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", - "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.8" + "security": "https://github.com/sebastianbergmann/comparator/security/policy", + "source": "https://github.com/sebastianbergmann/comparator/tree/6.2.1" }, "funding": [ { @@ -1209,33 +1172,33 @@ "type": "github" } ], - "time": "2022-09-14T12:41:17+00:00" + "time": "2024-10-31T05:30:08+00:00" }, { "name": "sebastian/complexity", - "version": "2.0.3", + "version": "4.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "25f207c40d62b8b7aa32f5ab026c53561964053a" + "reference": "ee41d384ab1906c68852636b6de493846e13e5a0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/25f207c40d62b8b7aa32f5ab026c53561964053a", - "reference": "25f207c40d62b8b7aa32f5ab026c53561964053a", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/ee41d384ab1906c68852636b6de493846e13e5a0", + "reference": "ee41d384ab1906c68852636b6de493846e13e5a0", "shasum": "" }, "require": { - "nikic/php-parser": "^4.18 || ^5.0", - "php": ">=7.3" + "nikic/php-parser": "^5.0", + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -1258,7 +1221,8 @@ "homepage": "https://github.com/sebastianbergmann/complexity", "support": { "issues": "https://github.com/sebastianbergmann/complexity/issues", - "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.3" + "security": "https://github.com/sebastianbergmann/complexity/security/policy", + "source": "https://github.com/sebastianbergmann/complexity/tree/4.0.1" }, "funding": [ { @@ -1266,33 +1230,33 @@ "type": "github" } ], - "time": "2023-12-22T06:19:30+00:00" + "time": "2024-07-03T04:49:50+00:00" }, { "name": "sebastian/diff", - "version": "4.0.6", + "version": "6.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc" + "reference": "b4ccd857127db5d41a5b676f24b51371d76d8544" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/ba01945089c3a293b01ba9badc29ad55b106b0bc", - "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/b4ccd857127db5d41a5b676f24b51371d76d8544", + "reference": "b4ccd857127db5d41a5b676f24b51371d76d8544", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3", + "phpunit/phpunit": "^11.0", "symfony/process": "^4.2 || ^5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -1324,7 +1288,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/4.0.6" + "security": "https://github.com/sebastianbergmann/diff/security/policy", + "source": "https://github.com/sebastianbergmann/diff/tree/6.0.2" }, "funding": [ { @@ -1332,27 +1297,27 @@ "type": "github" } ], - "time": "2024-03-02T06:30:58+00:00" + "time": "2024-07-03T04:53:05+00:00" }, { "name": "sebastian/environment", - "version": "5.1.5", + "version": "7.2.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed" + "reference": "855f3ae0ab316bbafe1ba4e16e9f3c078d24a0c5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", - "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/855f3ae0ab316bbafe1ba4e16e9f3c078d24a0c5", + "reference": "855f3ae0ab316bbafe1ba4e16e9f3c078d24a0c5", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "suggest": { "ext-posix": "*" @@ -1360,7 +1325,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "5.1-dev" + "dev-main": "7.2-dev" } }, "autoload": { @@ -1379,7 +1344,7 @@ } ], "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", + "homepage": "https://github.com/sebastianbergmann/environment", "keywords": [ "Xdebug", "environment", @@ -1387,7 +1352,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/environment/issues", - "source": "https://github.com/sebastianbergmann/environment/tree/5.1.5" + "security": "https://github.com/sebastianbergmann/environment/security/policy", + "source": "https://github.com/sebastianbergmann/environment/tree/7.2.0" }, "funding": [ { @@ -1395,34 +1361,34 @@ "type": "github" } ], - "time": "2023-02-03T06:03:51+00:00" + "time": "2024-07-03T04:54:44+00:00" }, { "name": "sebastian/exporter", - "version": "4.0.6", + "version": "6.3.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72" + "reference": "3473f61172093b2da7de1fb5782e1f24cc036dc3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/78c00df8f170e02473b682df15bfcdacc3d32d72", - "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/3473f61172093b2da7de1fb5782e1f24cc036dc3", + "reference": "3473f61172093b2da7de1fb5782e1f24cc036dc3", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/recursion-context": "^4.0" + "ext-mbstring": "*", + "php": ">=8.2", + "sebastian/recursion-context": "^6.0" }, "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "6.1-dev" } }, "autoload": { @@ -1464,7 +1430,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.6" + "security": "https://github.com/sebastianbergmann/exporter/security/policy", + "source": "https://github.com/sebastianbergmann/exporter/tree/6.3.0" }, "funding": [ { @@ -1472,38 +1439,35 @@ "type": "github" } ], - "time": "2024-03-02T06:33:00+00:00" + "time": "2024-12-05T09:17:50+00:00" }, { "name": "sebastian/global-state", - "version": "5.0.7", + "version": "7.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9" + "reference": "3be331570a721f9a4b5917f4209773de17f747d7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", - "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/3be331570a721f9a4b5917f4209773de17f747d7", + "reference": "3be331570a721f9a4b5917f4209773de17f747d7", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/object-reflector": "^2.0", - "sebastian/recursion-context": "^4.0" + "php": ">=8.2", + "sebastian/object-reflector": "^4.0", + "sebastian/recursion-context": "^6.0" }, "require-dev": { "ext-dom": "*", - "phpunit/phpunit": "^9.3" - }, - "suggest": { - "ext-uopz": "*" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-main": "7.0-dev" } }, "autoload": { @@ -1522,13 +1486,14 @@ } ], "description": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", + "homepage": "https://www.github.com/sebastianbergmann/global-state", "keywords": [ "global state" ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.7" + "security": "https://github.com/sebastianbergmann/global-state/security/policy", + "source": "https://github.com/sebastianbergmann/global-state/tree/7.0.2" }, "funding": [ { @@ -1536,33 +1501,33 @@ "type": "github" } ], - "time": "2024-03-02T06:35:11+00:00" + "time": "2024-07-03T04:57:36+00:00" }, { "name": "sebastian/lines-of-code", - "version": "1.0.4", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/lines-of-code.git", - "reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5" + "reference": "d36ad0d782e5756913e42ad87cb2890f4ffe467a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/e1e4a170560925c26d424b6a03aed157e7dcc5c5", - "reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/d36ad0d782e5756913e42ad87cb2890f4ffe467a", + "reference": "d36ad0d782e5756913e42ad87cb2890f4ffe467a", "shasum": "" }, "require": { - "nikic/php-parser": "^4.18 || ^5.0", - "php": ">=7.3" + "nikic/php-parser": "^5.0", + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -1585,7 +1550,8 @@ "homepage": "https://github.com/sebastianbergmann/lines-of-code", "support": { "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", - "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.4" + "security": "https://github.com/sebastianbergmann/lines-of-code/security/policy", + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/3.0.1" }, "funding": [ { @@ -1593,34 +1559,34 @@ "type": "github" } ], - "time": "2023-12-22T06:20:34+00:00" + "time": "2024-07-03T04:58:38+00:00" }, { "name": "sebastian/object-enumerator", - "version": "4.0.4", + "version": "6.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "5c9eeac41b290a3712d88851518825ad78f45c71" + "reference": "f5b498e631a74204185071eb41f33f38d64608aa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71", - "reference": "5c9eeac41b290a3712d88851518825ad78f45c71", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/f5b498e631a74204185071eb41f33f38d64608aa", + "reference": "f5b498e631a74204185071eb41f33f38d64608aa", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/object-reflector": "^2.0", - "sebastian/recursion-context": "^4.0" + "php": ">=8.2", + "sebastian/object-reflector": "^4.0", + "sebastian/recursion-context": "^6.0" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -1642,7 +1608,8 @@ "homepage": "https://github.com/sebastianbergmann/object-enumerator/", "support": { "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", - "source": "https://github.com/sebastianbergmann/object-enumerator/tree/4.0.4" + "security": "https://github.com/sebastianbergmann/object-enumerator/security/policy", + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/6.0.1" }, "funding": [ { @@ -1650,32 +1617,32 @@ "type": "github" } ], - "time": "2020-10-26T13:12:34+00:00" + "time": "2024-07-03T05:00:13+00:00" }, { "name": "sebastian/object-reflector", - "version": "2.0.4", + "version": "4.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7" + "reference": "6e1a43b411b2ad34146dee7524cb13a068bb35f9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", - "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/6e1a43b411b2ad34146dee7524cb13a068bb35f9", + "reference": "6e1a43b411b2ad34146dee7524cb13a068bb35f9", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -1697,7 +1664,8 @@ "homepage": "https://github.com/sebastianbergmann/object-reflector/", "support": { "issues": "https://github.com/sebastianbergmann/object-reflector/issues", - "source": "https://github.com/sebastianbergmann/object-reflector/tree/2.0.4" + "security": "https://github.com/sebastianbergmann/object-reflector/security/policy", + "source": "https://github.com/sebastianbergmann/object-reflector/tree/4.0.1" }, "funding": [ { @@ -1705,32 +1673,32 @@ "type": "github" } ], - "time": "2020-10-26T13:14:26+00:00" + "time": "2024-07-03T05:01:32+00:00" }, { "name": "sebastian/recursion-context", - "version": "4.0.5", + "version": "6.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1" + "reference": "694d156164372abbd149a4b85ccda2e4670c0e16" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", - "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/694d156164372abbd149a4b85ccda2e4670c0e16", + "reference": "694d156164372abbd149a4b85ccda2e4670c0e16", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -1760,7 +1728,8 @@ "homepage": "https://github.com/sebastianbergmann/recursion-context", "support": { "issues": "https://github.com/sebastianbergmann/recursion-context/issues", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.5" + "security": "https://github.com/sebastianbergmann/recursion-context/security/policy", + "source": "https://github.com/sebastianbergmann/recursion-context/tree/6.0.2" }, "funding": [ { @@ -1768,86 +1737,32 @@ "type": "github" } ], - "time": "2023-02-03T06:07:39+00:00" - }, - { - "name": "sebastian/resource-operations", - "version": "3.0.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "05d5692a7993ecccd56a03e40cd7e5b09b1d404e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/05d5692a7993ecccd56a03e40cd7e5b09b1d404e", - "reference": "05d5692a7993ecccd56a03e40cd7e5b09b1d404e", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides a list of PHP built-in functions that operate on resources", - "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "support": { - "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.4" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-03-14T16:00:52+00:00" + "time": "2024-07-03T05:10:34+00:00" }, { "name": "sebastian/type", - "version": "3.2.1", + "version": "5.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7" + "reference": "461b9c5da241511a2a0e8f240814fb23ce5c0aac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", - "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/461b9c5da241511a2a0e8f240814fb23ce5c0aac", + "reference": "461b9c5da241511a2a0e8f240814fb23ce5c0aac", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.5" + "phpunit/phpunit": "^11.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2-dev" + "dev-main": "5.1-dev" } }, "autoload": { @@ -1870,7 +1785,8 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/3.2.1" + "security": "https://github.com/sebastianbergmann/type/security/policy", + "source": "https://github.com/sebastianbergmann/type/tree/5.1.0" }, "funding": [ { @@ -1878,29 +1794,29 @@ "type": "github" } ], - "time": "2023-02-03T06:13:03+00:00" + "time": "2024-09-17T13:12:04+00:00" }, { "name": "sebastian/version", - "version": "3.0.2", + "version": "5.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "c6c1022351a901512170118436c764e473f6de8c" + "reference": "c687e3387b99f5b03b6caa64c74b63e2936ff874" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c", - "reference": "c6c1022351a901512170118436c764e473f6de8c", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c687e3387b99f5b03b6caa64c74b63e2936ff874", + "reference": "c687e3387b99f5b03b6caa64c74b63e2936ff874", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -1923,7 +1839,8 @@ "homepage": "https://github.com/sebastianbergmann/version", "support": { "issues": "https://github.com/sebastianbergmann/version/issues", - "source": "https://github.com/sebastianbergmann/version/tree/3.0.2" + "security": "https://github.com/sebastianbergmann/version/security/policy", + "source": "https://github.com/sebastianbergmann/version/tree/5.0.2" }, "funding": [ { @@ -1931,7 +1848,59 @@ "type": "github" } ], - "time": "2020-09-28T06:39:44+00:00" + "time": "2024-10-09T05:16:32+00:00" + }, + { + "name": "staabm/side-effects-detector", + "version": "1.0.5", + "source": { + "type": "git", + "url": "https://github.com/staabm/side-effects-detector.git", + "reference": "d8334211a140ce329c13726d4a715adbddd0a163" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/staabm/side-effects-detector/zipball/d8334211a140ce329c13726d4a715adbddd0a163", + "reference": "d8334211a140ce329c13726d4a715adbddd0a163", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "phpstan/extension-installer": "^1.4.3", + "phpstan/phpstan": "^1.12.6", + "phpunit/phpunit": "^9.6.21", + "symfony/var-dumper": "^5.4.43", + "tomasvotruba/type-coverage": "1.0.0", + "tomasvotruba/unused-public": "1.0.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "lib/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A static analysis tool to detect side effects in PHP code", + "keywords": [ + "static analysis" + ], + "support": { + "issues": "https://github.com/staabm/side-effects-detector/issues", + "source": "https://github.com/staabm/side-effects-detector/tree/1.0.5" + }, + "funding": [ + { + "url": "https://github.com/staabm", + "type": "github" + } + ], + "time": "2024-10-20T05:08:20+00:00" }, { "name": "theseer/tokenizer",