ddw147

Experience

5,610

0 Best Reply Awards

  • Member Since 2 Years Ago
  • 55 Lessons Completed
  • 1 Favorite

5th July, 2018

ddw147 left a reply on Http Test Redirecting To \ Instead Of Login • 2 months ago

Hi LoginController is default provided with laravel , no changes there

ddw147 started a new conversation Http Test Redirecting To \ Instead Of Login • 2 months ago

Hi I am trying out testing in laravel, but when try to test invalid login like below

public function testInvalidLogin()
    {
        $response = $this->post('/login',[ 'email'=>'[email protected]', 'password'=>'secret' ]);
        $response->assertStatus(302);
        $response->assertLocation('/login');
 }

but when i run this i got error

Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'http://localhost/login'
+'http://localhost'

D:\project\larademo\vendor\laravel\framework\src\Illuminate\Foundation\Testing\TestResponse.php:198
D:\project\larademo\tests\Feature\ExampleTest.php:38

FAILURES!
Tests: 3, Assertions: 5, Failures: 1.

I have also use 'followingRedirects()' but it is giving response code 200 and content of '/'

can you help me what is wrong here

7th July, 2017

ddw147 started a new conversation Help Needed For Creating App For Both Web And Mobile • 1 year ago

Hi I am creating an app for both web and mobile. Many sites suggested that I should develop rest API and consume in web via js framework and mobile via native functionality. but I don't want to get associated with certain js framework, as may be some other members will join they need learn that if needed so my approach was to create classes I call them service(this may be the wrong term). like UserService

Class UserService{ public static function updateUser(User $user , UserRequest $request) { //some code return user/false/null/error as needed } `}

and in web controller, i simply delegate this to service like

Class UserController{ public function update(User $user, Request $request ) { $resonse = UserService::updateUser($user,$request) //process response / return view/ redirect as needed }} and in api controller Class Api/UserController{ public function update(User $user, Request $request ) { $resonse = UserService::updateUser($user,$request) //return json response }} whats is your view on this approach, make suggestions if needed

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.