Page MenuHomekolab.org

User entitlements management
ClosedPublic

Authored by machniak on Mar 12 2020, 3:45 PM.

Details

Summary

Make packages and SKUs name+description localizable
Add package and sku controllers
User entitlements UI and API

TODO: browser tests and more feature tests

Diff Detail

Repository
rK kolab
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

machniak requested review of this revision.Mar 12 2020, 3:45 PM
machniak created this revision.
machniak updated this revision to Diff 2560.Mar 12 2020, 4:04 PM
  • Use Queue:: syntax, phpstan is now happy
vanmeeuwen requested changes to this revision.Mar 13 2020, 10:18 AM

The following test seems to fail;

$ vendor/bin/phpunit tests/Feature/Controller/DomainsTest.php 
PHPUnit 7.5.20 by Sebastian Bergmann and contributors.

Error:         No code coverage driver is available

F.F                                                                 3 / 3 (100%)

Time: 354 ms, Memory: 28.00 MB

There were 2 failures:

1) Tests\Feature\Controller\DomainsTest::testConfirm
Expected status code 200 but received 500.
Failed asserting that false is true.

/home/vanmeeuwen/devel/src/apheleia/kolab.git/src/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestResponse.php:151
/home/vanmeeuwen/devel/src/apheleia/kolab.git/src/tests/Feature/Controller/DomainsTest.php:58

2) Tests\Feature\Controller\DomainsTest::testShow
Expected status code 200 but received 500.
Failed asserting that false is true.

/home/vanmeeuwen/devel/src/apheleia/kolab.git/src/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestResponse.php:151
/home/vanmeeuwen/devel/src/apheleia/kolab.git/src/tests/Feature/Controller/DomainsTest.php:141

FAILURES!
Tests: 3, Assertions: 10, Failures: 2.

Because;

[2020-03-13 09:14:29] testing.DEBUG: [SQL] select * from `skus` where `skus`.`id` = ? limit 1 [2a1bb8ed-cda5-46d4-8142-c4d546b075b2]  
[2020-03-13 09:14:29] testing.ERROR: Sku not active  
[2020-03-13 09:14:29] testing.DEBUG: [SQL] select * from `domains` where `domains`.`id` = ? and `domains`.`deleted_at` is null limit 1 [1069549980]  
[2020-03-13 09:14:29] testing.DEBUG: [SQL] select * from `entitlements` where `entitlements`.`entitleable_id` = ? and `entitlements`.`entitleable_id` is not null and `entitlements`.`entitleable_type` = ? and `entitlements`.`deleted_at` is null limit 1 [1069549980, App\Domain]  
[2020-03-13 09:14:29] testing.ERROR: Trying to get property 'wallet' of non-object {"userId":1317732949,"exception":"[object] (ErrorException(code: 0): Trying to get property 'wallet' of non-object at /home/vanmeeuwen/devel/src/apheleia/kolab.git/src/app/Domain.php:348)
[stacktrace]
#0 /home/vanmeeuwen/devel/src/apheleia/kolab.git/src/app/Domain.php(348): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError(8, 'Trying to get p...', '/home/vanmeeuwe...', 348, Array)
#1 /home/vanmeeuwen/devel/src/apheleia/kolab.git/src/app/User.php(252): App\\Domain->wallet()
#2 /home/vanmeeuwen/devel/src/apheleia/kolab.git/src/app/Http/Controllers/API/DomainsController.php(115): App\\User->canRead(Object(App\\Domain))
#3 [internal function]: App\\Http\\Controllers\\API\\DomainsController->show('1069549980')

It seems that an unchanged file src/tests/Feature/Controller/DomainTest.php is using the domain SKU and not the domain-hosting SKU.

This revision now requires changes to proceed.Mar 13 2020, 10:18 AM
machniak updated this revision to Diff 2566.Mar 13 2020, 11:14 AM
  • Add browser tests, fix small issues
vanmeeuwen accepted this revision.Mar 13 2020, 11:35 AM
This revision is now accepted and ready to land.Mar 13 2020, 11:35 AM
This revision was automatically updated to reflect the committed changes.