<?php
use App\Device;
use App\Organization;
use App\Employee;
class DeviceTest extends TestCase
{
    /**
     * Test to check get devices
     *
     * @return void
     */
    public function testDevice()
    {
       $response = $this->call('GET', 'api/v1/device/');
       $this->assertEquals(200, $response->status());
    }
    
    /**
     * Test to check save device
     *
     * @return void
     */
    public function testSaveDevice()
    {
       $deviceId = str_random(20);
       $lastOrg = Organization::max('id');
       $employee = Employee::max('id');
       $this->post('api/v1/device', ['device_id' => $deviceId,
           'organization_id' => $lastOrg,
           'employee_id' => $employee,
           'os_type' => 'ios'
           ])
             ->seeJson([
                'status' => 'success',
             ]);

      $last = Device::max('id'); 
      $this->put('api/v1/device', ['id' => $last, 'status' => 1])
             ->seeJson([
                'status' => 'success',
             ]);
       Device::destroy($last);       
    }
    
    
}
