<?php

namespace Tests\Feature;
use App\Models\KriteriaModel;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker;
use Tests\TestCase;
use Illuminate\Support\Facades\DB;

class Kriteria extends TestCase
{
    /**
     * A basic feature test example.
     */
    public function testGetAllKriteria()
    {
        $kriteria = KriteriaModel::get_all_kriteria();
        $this->assertCount(15, $kriteria);
    }

    /**
     * Test menghapus data kriteria AHP.
     *
     * @return void
     */
   public function testDeleteKriteriaAhp()
    { 
        $result = KriteriaModel::delete_kriteria_ahp('id_kriteria_ahp'['1']);
        $this->assertTrue($result);
    }

    /**
     * Test menambahkan data kriteria AHP.
     *
     * @return void
     */
    public function testAddKriteriaAhp()
    {
        $params = [
            'id_kriteria_1' => 1,
            'id_kriteria_2' => 2,
            'nilai_1' => 0.5,
            'nilai_2' => 2,
        ];
        KriteriaModel::add_kriteria_ahp($params);
        $kriteriaAhp = KriteriaModel::get_kriteria_ahp(1, 2);
        $this->assertNotNull($kriteriaAhp);
        $this->assertEquals(0.5, $kriteriaAhp->nilai_1);
        $this->assertEquals(2, $kriteriaAhp->nilai_2);
    }
}
 


