public function testExecute() { $data = json_decode(json_encode([['place' => 1, 'id' => 123456, 'score' => 212312313123, 'name' => 'TestName', 'avatar' => 'TestAvatar.jpg'], ["place" => 2, "score" => 1000000, "id" => 2, "name" => "Vasya Pupkin", "avatar" => "http://.../avatar.jpg"], ["place" => 3, "score" => 1000000, "id" => 3, "name" => "Vasya Pupkin", "avatar" => "http://.../avatar.jpg"], ["place" => 4, "score" => 1000000, "id" => 4, "name" => "Vasya Pupkin", "avatar" => "http://.../avatar.jpg"], ["place" => 5, "score" => 1000000, "id" => 5, "name" => "Vasya Pupkin", "avatar" => "http://.../avatar.jpg"], ["place" => 6, "score" => 1000000, "id" => 6, "name" => "Vasya Pupkin", "avatar" => "http://.../avatar.jpg"], ["place" => 7, "score" => 1000000, "id" => 7, "name" => "Vasya Pupkin", "avatar" => "http://.../avatar.jpg"], ["place" => 8, "score" => 1000000, "id" => 8, "name" => "Vasya Pupkin", "avatar" => "http://.../avatar.jpg"], ["place" => 9, "score" => 1000000, "id" => 9, "name" => "Vasya Pupkin", "avatar" => "http://.../avatar.jpg"], ["place" => 10, "score" => 100012310, "id" => 1, "name" => "Vasya Pupkin", "avatar" => "http://.../avatar.jpg"]])); $preLeaders = [new Collection($data)]; $result = $this->service->statistics()->map(new GetHistoryProfileLeader(), [1, $preLeaders])->getResultMap(); $this->assertEquals(1, $result[0]->id); }
public function testExecute() { $data = json_decode(json_encode([['place' => 1, 'id' => 123456, 'score' => 212312313123, 'name' => 'TestName', 'avatar' => 'TestAvatar.jpg'], ["place" => 2, "score" => 1000000, "id" => 2, "name" => "Vasya Pupkin", "avatar" => "http://.../avatar.jpg"], ["place" => 3, "score" => 1000000, "id" => 3, "name" => "Vasya Pupkin", "avatar" => "http://.../avatar.jpg"], ["place" => 4, "score" => 1000000, "id" => 4, "name" => "Vasya Pupkin", "avatar" => "http://.../avatar.jpg"], ["place" => 5, "score" => 1000000, "id" => 5, "name" => "Vasya Pupkin", "avatar" => "http://.../avatar.jpg"], ["place" => 6, "score" => 1000000, "id" => 6, "name" => "Vasya Pupkin", "avatar" => "http://.../avatar.jpg"], ["place" => 7, "score" => 1000000, "id" => 7, "name" => "Vasya Pupkin", "avatar" => "http://.../avatar.jpg"], ["place" => 8, "score" => 1000000, "id" => 8, "name" => "Vasya Pupkin", "avatar" => "http://.../avatar.jpg"], ["place" => 9, "score" => 1000000, "id" => 9, "name" => "Vasya Pupkin", "avatar" => "http://.../avatar.jpg"], ["place" => 10, "score" => 100012310, "id" => 1, "name" => "Vasya Pupkin", "avatar" => "http://.../avatar.jpg"]])); $preLeaders = [new Collection($data)]; $result = $this->service->statistics()->map(new ChangesInTheNumberOfPositions(), [$this->service->getLeaders(), $preLeaders])->getResultMap(); $this->assertArrayHasKey(1, $result); $this->assertArrayHasKey(123456, $result); $this->assertEquals($result, [1 => 1, 123456 => 1]); }
public function testStatistics() { $statistics = $this->service->statistics(); $this->assertInstanceOf(StatisticsInterface::class, $statistics); }