Updated the tests due to the stats service changes.

pull/316/head
Ruslan Baidan 2020-07-14 11:23:52 +02:00
parent c4c1e2fc44
commit 48ef453db2
No known key found for this signature in database
GPG Key ID: 4B7724C136BF1D89
3 changed files with 78 additions and 99 deletions

122
composer.lock generated
View File

@ -497,16 +497,16 @@
},
{
"name": "doctrine/cache",
"version": "1.10.1",
"version": "1.10.2",
"source": {
"type": "git",
"url": "https://github.com/doctrine/cache.git",
"reference": "35a4a70cd94e09e2259dfae7488afc6b474ecbd3"
"reference": "13e3381b25847283a91948d04640543941309727"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/cache/zipball/35a4a70cd94e09e2259dfae7488afc6b474ecbd3",
"reference": "35a4a70cd94e09e2259dfae7488afc6b474ecbd3",
"url": "https://api.github.com/repos/doctrine/cache/zipball/13e3381b25847283a91948d04640543941309727",
"reference": "13e3381b25847283a91948d04640543941309727",
"shasum": ""
},
"require": {
@ -589,20 +589,20 @@
"type": "tidelift"
}
],
"time": "2020-05-27T16:24:54+00:00"
"time": "2020-07-07T18:54:01+00:00"
},
{
"name": "doctrine/collections",
"version": "1.6.5",
"version": "1.6.6",
"source": {
"type": "git",
"url": "https://github.com/doctrine/collections.git",
"reference": "fc0206348e17e530d09463fef07ba8968406cd6d"
"reference": "5f0470363ff042d0057006ae7acabc5d7b5252d5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/collections/zipball/fc0206348e17e530d09463fef07ba8968406cd6d",
"reference": "fc0206348e17e530d09463fef07ba8968406cd6d",
"url": "https://api.github.com/repos/doctrine/collections/zipball/5f0470363ff042d0057006ae7acabc5d7b5252d5",
"reference": "5f0470363ff042d0057006ae7acabc5d7b5252d5",
"shasum": ""
},
"require": {
@ -668,7 +668,7 @@
"type": "tidelift"
}
],
"time": "2020-05-25T19:24:35+00:00"
"time": "2020-06-22T19:14:02+00:00"
},
{
"name": "doctrine/common",
@ -4074,12 +4074,12 @@
"source": {
"type": "git",
"url": "https://github.com/monarc-project/zm-client.git",
"reference": "8990aadf0ceeb332cd53aa4a00c75f58a83868b2"
"reference": "c1d370e2cb2ec768093ebc24321dce06d09f6dc4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/monarc-project/zm-client/zipball/8990aadf0ceeb332cd53aa4a00c75f58a83868b2",
"reference": "8990aadf0ceeb332cd53aa4a00c75f58a83868b2",
"url": "https://api.github.com/repos/monarc-project/zm-client/zipball/c1d370e2cb2ec768093ebc24321dce06d09f6dc4",
"reference": "c1d370e2cb2ec768093ebc24321dce06d09f6dc4",
"shasum": ""
},
"require": {
@ -4154,7 +4154,7 @@
}
],
"description": "Frontoffice for monarc/monarc application",
"time": "2020-07-03T12:44:45+00:00"
"time": "2020-07-14T09:04:57+00:00"
},
{
"name": "monarc/phpword",
@ -5200,16 +5200,16 @@
},
{
"name": "symfony/deprecation-contracts",
"version": "v2.1.2",
"version": "v2.1.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/deprecation-contracts.git",
"reference": "dd99cb3a0aff6cadd2a8d7d7ed72c2161e218337"
"reference": "5e20b83385a77593259c9f8beb2c43cd03b2ac14"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/dd99cb3a0aff6cadd2a8d7d7ed72c2161e218337",
"reference": "dd99cb3a0aff6cadd2a8d7d7ed72c2161e218337",
"url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/5e20b83385a77593259c9f8beb2c43cd03b2ac14",
"reference": "5e20b83385a77593259c9f8beb2c43cd03b2ac14",
"shasum": ""
},
"require": {
@ -5219,6 +5219,10 @@
"extra": {
"branch-alias": {
"dev-master": "2.1-dev"
},
"thanks": {
"name": "symfony/contracts",
"url": "https://github.com/symfony/contracts"
}
},
"autoload": {
@ -5256,7 +5260,7 @@
"type": "tidelift"
}
],
"time": "2020-05-27T08:34:37+00:00"
"time": "2020-06-06T08:49:21+00:00"
},
{
"name": "symfony/filesystem",
@ -5941,16 +5945,16 @@
},
{
"name": "symfony/service-contracts",
"version": "v2.1.2",
"version": "v2.1.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/service-contracts.git",
"reference": "66a8f0957a3ca54e4f724e49028ab19d75a8918b"
"reference": "58c7475e5457c5492c26cc740cc0ad7464be9442"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/service-contracts/zipball/66a8f0957a3ca54e4f724e49028ab19d75a8918b",
"reference": "66a8f0957a3ca54e4f724e49028ab19d75a8918b",
"url": "https://api.github.com/repos/symfony/service-contracts/zipball/58c7475e5457c5492c26cc740cc0ad7464be9442",
"reference": "58c7475e5457c5492c26cc740cc0ad7464be9442",
"shasum": ""
},
"require": {
@ -5964,6 +5968,10 @@
"extra": {
"branch-alias": {
"dev-master": "2.1-dev"
},
"thanks": {
"name": "symfony/contracts",
"url": "https://github.com/symfony/contracts"
}
},
"autoload": {
@ -6009,7 +6017,7 @@
"type": "tidelift"
}
],
"time": "2020-05-20T17:43:50+00:00"
"time": "2020-07-06T13:23:11+00:00"
},
{
"name": "symfony/string",
@ -6654,33 +6662,33 @@
},
{
"name": "phpspec/prophecy",
"version": "v1.10.3",
"version": "1.11.1",
"source": {
"type": "git",
"url": "https://github.com/phpspec/prophecy.git",
"reference": "451c3cd1418cf640de218914901e51b064abb093"
"reference": "b20034be5efcdab4fb60ca3a29cba2949aead160"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/451c3cd1418cf640de218914901e51b064abb093",
"reference": "451c3cd1418cf640de218914901e51b064abb093",
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/b20034be5efcdab4fb60ca3a29cba2949aead160",
"reference": "b20034be5efcdab4fb60ca3a29cba2949aead160",
"shasum": ""
},
"require": {
"doctrine/instantiator": "^1.0.2",
"php": "^5.3|^7.0",
"phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0|^5.0",
"sebastian/comparator": "^1.2.3|^2.0|^3.0|^4.0",
"sebastian/recursion-context": "^1.0|^2.0|^3.0|^4.0"
"doctrine/instantiator": "^1.2",
"php": "^7.2",
"phpdocumentor/reflection-docblock": "^5.0",
"sebastian/comparator": "^3.0 || ^4.0",
"sebastian/recursion-context": "^3.0 || ^4.0"
},
"require-dev": {
"phpspec/phpspec": "^2.5 || ^3.2",
"phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1"
"phpspec/phpspec": "^6.0",
"phpunit/phpunit": "^8.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.10.x-dev"
"dev-master": "1.11.x-dev"
}
},
"autoload": {
@ -6713,7 +6721,7 @@
"spy",
"stub"
],
"time": "2020-03-05T15:02:03+00:00"
"time": "2020-07-08T12:44:21+00:00"
},
{
"name": "phpunit/php-code-coverage",
@ -7066,12 +7074,12 @@
"source": {
"type": "git",
"url": "https://github.com/Roave/SecurityAdvisories.git",
"reference": "9ec84501a85a3b0c7b260042ae81a8efb2f234ce"
"reference": "881b9e4a8de3186c93904230bdf6344b685fe6a5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/9ec84501a85a3b0c7b260042ae81a8efb2f234ce",
"reference": "9ec84501a85a3b0c7b260042ae81a8efb2f234ce",
"url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/881b9e4a8de3186c93904230bdf6344b685fe6a5",
"reference": "881b9e4a8de3186c93904230bdf6344b685fe6a5",
"shasum": ""
},
"conflict": {
@ -7140,6 +7148,7 @@
"friendsofsymfony/user-bundle": ">=1.2,<1.3.5",
"fuel/core": "<1.8.1",
"getgrav/grav": "<1.7-beta.8",
"gos/web-socket-bundle": "<1.10.4|>=2,<2.6.1|>=3,<3.3",
"gree/jose": "<=2.2",
"gregwar/rst": "<1.0.3",
"guzzlehttp/guzzle": ">=4-rc.2,<4.2.4|>=5,<5.3.1|>=6,<6.2.1",
@ -7165,6 +7174,7 @@
"magento/product-community-edition": ">=2,<2.2.10|>=2.3,<2.3.2-p.2",
"monolog/monolog": ">=1.8,<1.12",
"namshi/jose": "<2.2",
"nystudio107/craft-seomatic": "<3.3",
"nzo/url-encryptor-bundle": ">=4,<4.3.2|>=5,<5.0.1",
"october/october": ">=1.0.319,<1.0.467",
"onelogin/php-saml": "<2.10.4",
@ -7343,7 +7353,7 @@
"type": "tidelift"
}
],
"time": "2020-07-02T17:01:23+00:00"
"time": "2020-07-11T19:04:25+00:00"
},
{
"name": "sebastian/code-unit-reverse-lookup",
@ -7962,23 +7972,23 @@
},
{
"name": "theseer/tokenizer",
"version": "1.1.3",
"version": "1.2.0",
"source": {
"type": "git",
"url": "https://github.com/theseer/tokenizer.git",
"reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9"
"reference": "75a63c33a8577608444246075ea0af0d052e452a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/theseer/tokenizer/zipball/11336f6f84e16a720dae9d8e6ed5019efa85a0f9",
"reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9",
"url": "https://api.github.com/repos/theseer/tokenizer/zipball/75a63c33a8577608444246075ea0af0d052e452a",
"reference": "75a63c33a8577608444246075ea0af0d052e452a",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-tokenizer": "*",
"ext-xmlwriter": "*",
"php": "^7.0"
"php": "^7.2 || ^8.0"
},
"type": "library",
"autoload": {
@ -7998,24 +8008,30 @@
}
],
"description": "A small library for converting tokenized PHP source code into XML and potentially other formats",
"time": "2019-06-13T22:48:21+00:00"
"funding": [
{
"url": "https://github.com/theseer",
"type": "github"
}
],
"time": "2020-07-12T23:59:07+00:00"
},
{
"name": "webmozart/assert",
"version": "1.9.0",
"version": "1.9.1",
"source": {
"type": "git",
"url": "https://github.com/webmozart/assert.git",
"reference": "9dc4f203e36f2b486149058bade43c851dd97451"
"reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/webmozart/assert/zipball/9dc4f203e36f2b486149058bade43c851dd97451",
"reference": "9dc4f203e36f2b486149058bade43c851dd97451",
"url": "https://api.github.com/repos/webmozart/assert/zipball/bafc69caeb4d49c39fd0779086c03a3738cbb389",
"reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389",
"shasum": ""
},
"require": {
"php": "^5.3.3 || ^7.0",
"php": "^5.3.3 || ^7.0 || ^8.0",
"symfony/polyfill-ctype": "^1.8"
},
"conflict": {
@ -8047,7 +8063,7 @@
"check",
"validate"
],
"time": "2020-06-16T10:16:42+00:00"
"time": "2020-07-08T17:02:28+00:00"
}
],
"aliases": [

View File

@ -30,8 +30,8 @@ class StatsAnrServiceTest extends AbstractIntegrationTestCase
/** @var MockHandler */
private $statsApiMockHandler;
/** @var array */
private $currentDateParams;
/** @var string */
private $currentDate;
/** @var StatsAnrService */
private $statsAnrService;
@ -50,7 +50,7 @@ class StatsAnrServiceTest extends AbstractIntegrationTestCase
{
parent::setUp();
$this->currentDateParams = $this->getCurrentDateParams();
$this->currentDate = (new DateTime())->format('Y-m-d');
$this->statsAnrService = $this->getApplicationServiceLocator()->get(StatsAnrService::class);
}
@ -440,28 +440,11 @@ class StatsAnrServiceTest extends AbstractIntegrationTestCase
foreach ($anrUuids as $num => $anrUuid) {
foreach ($statsData as $data) {
$data['anr'] = $anrUuid;
$data['day'] = $this->currentDateParams['day'];
$data['week'] = $this->currentDateParams['week'];
$data['month'] = $this->currentDateParams['month'];
$data['quarter'] = $this->currentDateParams['quarter'];
$data['year'] = $this->currentDateParams['year'];
$data['date'] = $this->currentDate;
$expectedStats[] = $data;
}
}
return json_encode($expectedStats);
}
private function getCurrentDateParams(): array
{
$dateTime = new DateTime();
return [
'day' => (int)$dateTime->format('z') + 1,
'week' => (int)$dateTime->format('W'),
'month' => (int)$dateTime->format('m'),
'quarter' => (int)ceil($dateTime->format('m') / 3),
'year' => (int)$dateTime->format('Y'),
];
}
}

View File

@ -2,11 +2,7 @@
{
"anr": "{{uuid}}",
"type": "risk",
"day": "{{day}}",
"week": "{{week}}",
"month": "{{month}}",
"quarter": "{{quarter}}",
"year": "{{year}}",
"date": "{{date}}",
"data": {
"risks": {
"current": {
@ -85,11 +81,7 @@
{
"anr": "{{uuid}}",
"type": "threat",
"day": "{{day}}",
"week": "{{week}}",
"month": "{{month}}",
"quarter": "{{quarter}}",
"year": "{{year}}",
"date": "{{date}}",
"data": [
{
"averageRate": "2.82",
@ -316,11 +308,7 @@
{
"anr": "{{uuid}}",
"type": "vulnerability",
"day": "{{day}}",
"week": "{{week}}",
"month": "{{month}}",
"quarter": "{{quarter}}",
"year": "{{year}}",
"date": "{{date}}",
"data": [
{
"averageRate": "4.00",
@ -917,11 +905,7 @@
{
"anr": "{{uuid}}",
"type": "cartography",
"day": "{{day}}",
"week": "{{week}}",
"month": "{{month}}",
"quarter": "{{quarter}}",
"year": "{{year}}",
"date": "{{date}}",
"data": {
"risks": {
"current": {
@ -1050,11 +1034,7 @@
{
"anr": "{{uuid}}",
"type": "compliance",
"day": "{{day}}",
"week": "{{week}}",
"month": "{{month}}",
"quarter": "{{quarter}}",
"year": "{{year}}",
"date": "{{date}}",
"data": [
{
"current": [