title: Call to undefined method Tests\Unit\TopPageTest::get() in Unit test in Laravel 8
body: <p>I am writing a code to make Unit test for each pages in my project and started with the Main page. The main page consists of shop lists, genre lists and area lists.</p>
  <p>tests\Unit\ToppageTest.php :</p>
  <pre><code>&lt;?php
  
  namespace Tests\Unit;
  
  use PHPUnit\Framework\TestCase;
  // use Tests\TestCase;
  use Illuminate\Foundation\Testing\RefreshDatabase;
  use App\Models\Shop;
  
  class TopPageTest extends TestCase
  {
      /**
       * A basic test example.
       *
       * @return void
       */
      public function testIndex()
      {
          $response = $this-&gt;get('/');
          $this-&gt;assertContains('data', $response-&gt;content());
          $response-&gt;assertSuccessful();
      }
  }
  
  </code></pre>
  <p>phpunit.xml:</p>
  <pre><code> &lt;php&gt;
          &lt;server name=&quot;APP_ENV&quot; value=&quot;testing&quot;/&gt;
          &lt;server name=&quot;BCRYPT_ROUNDS&quot; value=&quot;4&quot;/&gt;
          &lt;server name=&quot;CACHE_DRIVER&quot; value=&quot;array&quot;/&gt;
          &lt;server name=&quot;MAIL_DRIVER&quot; value=&quot;array&quot;/&gt;
          &lt;server name=&quot;DB_CONNECTION&quot; value=&quot;sqlite&quot;/&gt;
          &lt;server name=&quot;DB_DATABASE&quot; value=&quot;:memory:&quot;/&gt;
          &lt;server name=&quot;MAIL_MAILER&quot; value=&quot;array&quot;/&gt;
          &lt;server name=&quot;QUEUE_CONNECTION&quot; value=&quot;sync&quot;/&gt;
          &lt;server name=&quot;SESSION_DRIVER&quot; value=&quot;array&quot;/&gt;
          &lt;server name=&quot;TELESCOPE_ENABLED&quot; value=&quot;false&quot;/&gt;
      &lt;/php&gt;
  </code></pre>
  <p>App\Http\Controllers\TopController.php:</p>
  <pre><code>&lt;?php
  
  namespace App\Http\Controllers;
  
  use Illuminate\Http\Request;
  use App\Services\ToppageService;
  
  class TopController extends Controller
  {
      private $shop;
  
      public function __construct(ToppageService $shop)
      {
          $this-&gt;shop = $shop;
      }
      /**
       * Display a listing of the resource.
       *
       * @return \Illuminate\Http\Response
       */
      public function index()
      {
          $data = $this-&gt;shop-&gt;getAllServicer();
           return view('index', compact('data'));
  
      }
  
  }
  </code></pre>
  <p>App\Http\Services\ToppageService.php:</p>
  <pre><code>&lt;?php
  
  namespace App\Services;
  
  use App\Services\BaseService;
  use App\Models\Shop;
  use App\Models\Genre;
  use App\Models\Area;
  
  class ToppageService extends BaseService
  {
      protected $shop, $genre, $area;
  
      public function __construct(Shop $shop, Genre $genre, Area $area)
      {
          $this-&gt;shop = $shop;
          $this-&gt;genre = $genre;
          $this-&gt;area = $area;
      }
  
      public function getAllServicer()
      {
          $data = [] ;
          $data['shoplist'] = $this-&gt;shop-&gt;with('attribute','content','coupon','menu_categoly','area','genre')-&gt;whereHas('servicer',function($query){$query-&gt;where('name', config('const.system.setting.servicer'));})-&gt;orderBy('created_at', 'DESC')-&gt;get();
          $data['genrelist'] = $this-&gt;genre-&gt;get();
          $data['arealist'] = $this-&gt;area-&gt;get();
          return $data;
      }
  }
  
  </code></pre>
  <p>When I enter php artisan test or vendor/bin/phpunit in command prompt, I get an error like:</p>
  <pre><code>Call to undefined method Tests\Unit\TopPageTest::get()
  
    at E:\tulsi\wparijat\laravel\laravel-awapass\app.awapass.com\tests\Unit\ToppageTest.php:20
       16▕      */
       17▕     public function testIndex()
       18▕     {
       19▕         //not working
    ➜  20▕         $response = $this-&gt;get('/');
       21▕         $this-&gt;assertContains('data', $response-&gt;content());
       22▕         $response-&gt;assertSuccessful();
       23▕     }
       24▕ }
  
    1   E:\tulsi\wparijat\laravel\laravel-awapass\app.awapass.com\vendor\phpunit\phpunit\phpunit:76
        PHPUnit\TextUI\Command::main()
  
  
    Tests:  1 failed
    Time:   0.05s
  </code></pre>
  <p>when I add  use Tests\TestCase; instead of use PHPUnit\Framework\TestCase;</p>
  <p>I get error:</p>
  <pre><code>Warning: TTY mode is not supported on Windows platform.
  </code></pre>
  <p>I searched for solution for could't get the exact solution for this. Can anyone please help me?</p>