mohib_ullah's avatar

Phpunit test faild on a new package

i was trying to test my newly created package by running bellow code

public function testBasicTest()
{
        $response = $this->call('GET','/');

        $response->assertStatus(200);
    }

and getting this error

 vagrant@homestead:~/home-rent/Catalog$ composer test                                              
> vendor/bin/phpunit                                                                              
PHPUnit 8.5.15 by Sebastian Bergmann and contributors.                                            
                                                                                                  
Runtime:       PHP 7.4.14                                                                         
Configuration: /home/vagrant/home-rent/Catalog/phpunit.xml                                        
                                                                                                  
E.                                                                  2 / 2 (100%)                  
                                                                                                  
Time: 1.27 seconds, Memory: 20.00 MB                                                              
                                                                                                  
There was 1 error:                                                                                
                                                                                                  
1) Thecore\Catalog\Tests\Feature\ExampleTest::testBasicTest                                       
Symfony\Component\HttpKernel\Exception\NotFoundHttpException: GET http://homerent.test            
                                                                                                  
/home/vagrant/home-rent/Catalog/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concern
s/InteractsWithExceptionHandling.php:118                                                          
/home/vagrant/home-rent/Catalog/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php
:326                                                                                              
/home/vagrant/home-rent/Catalog/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php
:120                                                                                              
/home/vagrant/home-rent/Catalog/vendor/laravel/framework/src/Illuminate/Foundation/Testing/Concern
s/MakesHttpRequests.php:375                                                                       
/home/vagrant/home-rent/Catalog/tests/Feature/ExampleTest.php:16                                  
                                                                                                  
ERRORS!                                                                                           
Tests: 2, Assertions: 1, Errors: 1.                                                               
Script vendor/bin/phpunit handling the test event returned with error code 2                      

How to solve this ??

0 likes
1 reply

Please or to participate in this conversation.