Optimise tests

This commit is contained in:
James Cole 2020-08-01 05:34:32 +02:00
parent e0b71c316b
commit 57cb325639
No known key found for this signature in database
GPG Key ID: B5669F9493CDE38D
3 changed files with 21 additions and 46 deletions

43
composer.lock generated
View File

@ -7314,16 +7314,16 @@
},
{
"name": "ergebnis/phpstan-rules",
"version": "0.15.0",
"version": "0.15.1",
"source": {
"type": "git",
"url": "https://github.com/ergebnis/phpstan-rules.git",
"reference": "f0c49d0efdaebd9e663e9e5637253ebcc41048d7"
"reference": "e6e2bbf0edd7f78b26dfd72daa01d28500ad3e6c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ergebnis/phpstan-rules/zipball/f0c49d0efdaebd9e663e9e5637253ebcc41048d7",
"reference": "f0c49d0efdaebd9e663e9e5637253ebcc41048d7",
"url": "https://api.github.com/repos/ergebnis/phpstan-rules/zipball/e6e2bbf0edd7f78b26dfd72daa01d28500ad3e6c",
"reference": "e6e2bbf0edd7f78b26dfd72daa01d28500ad3e6c",
"shasum": ""
},
"require": {
@ -7333,18 +7333,18 @@
"phpstan/phpstan": "~0.11.15 || ~0.12.0"
},
"require-dev": {
"ergebnis/composer-normalize": "^2.5.1",
"ergebnis/license": "~1.0.0",
"ergebnis/php-cs-fixer-config": "^2.1.2",
"ergebnis/test-util": "~1.0.0",
"ergebnis/composer-normalize": "^2.6.1",
"ergebnis/license": "^1.0.0",
"ergebnis/php-cs-fixer-config": "^2.2.1",
"ergebnis/test-util": "^1.0.0",
"infection/infection": "~0.13.6",
"nette/di": "^3.0.1",
"phpstan/phpstan-deprecation-rules": "~0.11.2",
"phpstan/phpstan-strict-rules": "~0.11.1",
"phpunit/phpunit": "^7.5.20",
"psalm/plugin-phpunit": "~0.10.0",
"psalm/plugin-phpunit": "~0.10.1",
"psr/container": "^1.0.0",
"vimeo/psalm": "^3.11.2",
"vimeo/psalm": "^3.13.1",
"zendframework/zend-servicemanager": "^2.0.0"
},
"type": "phpstan-extension",
@ -7378,24 +7378,12 @@
"phpstan-rules"
],
"funding": [
{
"url": "https://paypal.me/localheinz",
"type": "custom"
},
{
"url": "https://www.amazon.de/hz/wishlist/ls/2NCHMSJ4BC1OW",
"type": "custom"
},
{
"url": "https://www.buymeacoffee.com/localheinz",
"type": "custom"
},
{
"url": "https://github.com/localheinz",
"type": "github"
}
],
"time": "2020-05-10T18:39:28+00:00"
"time": "2020-07-31T18:01:05+00:00"
},
{
"name": "felixfbecker/advanced-json-rpc",
@ -9085,12 +9073,12 @@
"source": {
"type": "git",
"url": "https://github.com/Roave/SecurityAdvisories.git",
"reference": "f693c37873d31bff5adb1279cb05a2f4ce5efb43"
"reference": "38ea77863c1b13199948363e9cf7f7dd35a06e37"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/f693c37873d31bff5adb1279cb05a2f4ce5efb43",
"reference": "f693c37873d31bff5adb1279cb05a2f4ce5efb43",
"url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/38ea77863c1b13199948363e9cf7f7dd35a06e37",
"reference": "38ea77863c1b13199948363e9cf7f7dd35a06e37",
"shasum": ""
},
"conflict": {
@ -9174,6 +9162,7 @@
"joomla/session": "<1.3.1",
"jsmitty12/phpwhois": "<5.1",
"kazist/phpwhois": "<=4.2.6",
"kitodo/presentation": "<3.1.2",
"kreait/firebase-php": ">=3.2,<3.8.1",
"la-haute-societe/tcpdf": "<6.2.22",
"laravel/framework": ">=4,<4.0.99|>=4.1,<=4.1.31|>=4.2,<=4.2.22|>=5,<=5.0.35|>=5.1,<=5.1.46|>=5.2,<=5.2.45|>=5.3,<=5.3.31|>=5.4,<=5.4.36|>=5.5,<5.5.42|>=5.6,<5.6.30|>=7,<7.1.2",
@ -9369,7 +9358,7 @@
"type": "tidelift"
}
],
"time": "2020-07-29T19:02:51+00:00"
"time": "2020-07-31T18:02:22+00:00"
},
{
"name": "sebastian/code-unit-reverse-lookup",

View File

@ -33,17 +33,17 @@
<listener class="JohnKary\PHPUnit\Listener\SpeedTrapListener" />
</listeners>
<testsuites>
<!--
<testsuite name="Api">
<directory suffix="Test.php">./tests/Api</directory>
</testsuite>
<!--
<testsuite name="Unit">
<directory suffix="Test.php">./tests/Unit</directory>
</testsuite>
<testsuite name="Feature">
<directory suffix="Test.php">./tests/Feature</directory>
</testsuite>
-->
<testsuite name="Unit">
<directory suffix="Test.php">./tests/Unit</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">

View File

@ -62,13 +62,9 @@ class AccountFactoryTest extends TestCase
* @covers \FireflyIII\Services\Internal\Support\AccountServiceTrait
* @covers \FireflyIII\Services\Internal\Support\LocationServiceTrait
*/
public function testCreate(): void
public function testCreateNoMockery(): void
{
// mock repositories
$accountRepos = $this->mock(AccountRepositoryInterface::class);
$metaFactory = $this->mock(AccountMetaFactory::class);
$currencyFactory = $this->mock(TransactionCurrencyFactory::class);
$euro = $this->getEuro();
$data = [
'account_type_id' => null,
'account_type' => 'asset',
@ -79,16 +75,6 @@ class AccountFactoryTest extends TestCase
'account_role' => 'defaultAsset',
];
// no currency submitted means: find the EURO:
Amount::shouldReceive('getDefaultCurrencyByUser')->atLeast()->once()->andReturn($euro);
$currencyFactory->shouldReceive('find')->withArgs([0, ''])->atLeast()->once()->andReturnNull();
$metaFactory->shouldReceive('crud')->withArgs([Mockery::any(), 'account_role', 'defaultAsset'])->atLeast()->once()->andReturnNull();
$metaFactory->shouldReceive('crud')->withArgs([Mockery::any(), 'currency_id', '1'])->atLeast()->once()->andReturnNull();
// get opening balance group (null for new accounts)
$accountRepos->shouldReceive('getOpeningBalanceGroup')->atLeast()->once()->andReturn(null);
/** @var AccountFactory $factory */
$factory = app(AccountFactory::class);
$factory->setUser($this->user());