Algo-Web / POData-Laravel-NorthWind

0 stars 3 forks source link

Setup instruction are missing. NotFoundHttpException in RouteCollection.php #1

Closed kirill533 closed 5 years ago

kirill533 commented 5 years ago

I tried to setup the test env following the travis.yml file. First I was getting errors related to cipher.

I did the following to fix it:

  1. Made copy of .env.example named as .env .
  2. Ran "php artisan key:generate"
  3. Copied generated key from .env file to config/app.php file.

But now tests fail and on the page http://localhost:8000/odata.svc/$metadata I get following error:

NotFoundHttpException in RouteCollection.php line 161:
in RouteCollection.php line 161
at RouteCollection->match(object(Request)) in Router.php line 750
at Router->findRoute(object(Request)) in Router.php line 659
at Router->dispatchToRoute(object(Request)) in Router.php line 635
at Router->dispatch(object(Request)) in Kernel.php line 236
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in VerifyCsrfToken.php line 50
at VerifyCsrfToken->handle(object(Request), object(Closure))
at call_user_func_array(array(object(VerifyCsrfToken), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in ShareErrorsFromSession.php line 49
at ShareErrorsFromSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(ShareErrorsFromSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in StartSession.php line 62
at StartSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(StartSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 37
at AddQueuedCookiesToResponse->handle(object(Request), object(Closure))
at call_user_func_array(array(object(AddQueuedCookiesToResponse), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in EncryptCookies.php line 59
at EncryptCookies->handle(object(Request), object(Closure))
at call_user_func_array(array(object(EncryptCookies), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in CheckForMaintenanceMode.php line 44
at CheckForMaintenanceMode->handle(object(Request), object(Closure))
at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
at Pipeline->then(object(Closure)) in Kernel.php line 122
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 87
at Kernel->handle(object(Request)) in index.php line 54
at require_once('/home/kirill533/projects/POData-Laravel-NorthWind/public/index.php') in server.php line 21

Same error also makes phpunit tests fail.

Did I made everything right? Would that be possible to provide some instructions on how to setup the working application?

CyberiaResurrection commented 5 years ago

@kirill533 , thanks for your efforts trying to spin this up. Let me see what I can do to help sort out your problem.

How have you deployed this package, and how are you serving it to trip the message you got in your initial report?

kirill533 commented 5 years ago

I run "php artisan serve" in package directory and then I access the URL posted. In the browser I get the error report I have posted. I also dumped response inside the phpunit test XMLMetadataTest.php and saw the same html output.

This unit test and 15 others fail with the same error: `Expected :3.0; Actual :null

/home/kirill533/projects/POData-Laravel-NorthWind/tests/XMLMetadataTest.php:38 /home/kirill533/projects/POData-Laravel-NorthWind/tests/XMLMetadataTest.php:157 /home/kirill533/projects/POData-Laravel-NorthWind/tests/XMLMetadataTest.php:186`

CyberiaResurrection commented 5 years ago

@kirill533 , I've managed to reproduce your report in its essentials, including the version number showing up as null, not 3.0 (per test expectations). Thanks for the pointer - I'm wondering where routing got bored somewhere in the past two years and wandered off.

CyberiaResurrection commented 5 years ago

@kirill533 , I've pushed out changes that should fix up your routing issues. Can you pull them and see if your pain persists?

CyberiaResurrection commented 5 years ago

@kirill533 , I've sent up a pull request at #2 - can you review my initial cut at setup docs and point out where I've assumed too much background knowledge, flat out missed something, etc?

As for remaining validation failures, @c-harris would be better suited to help you.

kirill533 commented 5 years ago

Thank for fixing it so fast and for mentioning me in the readme. The problem with the exception is fixed.

But for the setup instructions. I think, I have to anyway modify config/database.php file to setup connection properly (I still use mysql).

I am also trying to create some user to be able to access the API, but it is not so obvious how can I do that. Could you please extend the setup instructions by pointing on how to setup the api user? I cannot manage to create users table.

kirill533 commented 5 years ago

Following instructions on this page https://stackoverflow.com/questions/53257296/creating-users-table-in-laravel I managed to create table for users.

Then I used "php artisan tinker" and run DB::table('users')->insert(['name'=>'MyUsername','email'=>'thisis@myemail.com','password'=>Hash::make('123456')]) , so finally I got my user setup.

For login to the API I used email (not the user name) and that seemed to work.

CyberiaResurrection commented 5 years ago

Credit where credit is due, @kirill533 - you've pointed out where I did assume too much.

CyberiaResurrection commented 5 years ago

Is what's up in #2 now any clearer, @kirill533 ?

kirill533 commented 5 years ago

Hi @CyberiaResurrection, now it is looking sufficient. Discovering APP_DISABLE_AUTH option was very useful. Thanks a lot!

CyberiaResurrection commented 5 years ago

Thanks for the feedback and glad to hear you're underway. Closing this issue, then rolling up #2.