Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/mcoil.corals.io/tests/Unit/Cities/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/mcoil.corals.io/tests/Unit/Cities/CityUnitTest.php
<?php

namespace Tests\Unit\Cities;

use App\Shop\Cities\Exceptions\CityNotFoundException;
use App\Shop\Cities\Repositories\CityRepository;
use App\Shop\Cities\City;
use Tests\TestCase;

class CityUnitTest extends TestCase
{
    /** @test */
    public function it_can_list_all_the_cities()
    {
        $city = factory(City::class)->create();
        $cityRepo = new CityRepository($city);

        $this->assertCount(1, $cityRepo->listCities());
    }
    
    /** @test */
    public function it_can_update_the_city()
    {
        $city = factory(City::class)->create();
        $cityRepo = new CityRepository($city);

        $update = ['name' => 'Manila'];
        $updated = $cityRepo->updateCity($update);

        $this->assertTrue($updated);
    }
    
    /** @test */
    public function it_will_error_when_city_is_not_found()
    {
        $this->expectException(CityNotFoundException::class);

        $cityRepo = new CityRepository(new City);
        $cityRepo->findCityByName('unknown');
    }

    /** @test */
    public function it_can_find_the_city()
    {
        $city = factory(City::class)->create();
        $cityRepo = new CityRepository(new City);
        $found = $cityRepo->findCityByName($city->name);

        $this->assertEquals($city->name, $found->name);
    }
}

Spamworldpro Mini