mardi 9 juin 2020

@covers not working for some functions while generating coverage report

I am trying to generate the coverage report for my test case but I found @covers function included some functions in coverage not all below is my test cases.

Not covered in the coverage report

   /**
     * @depends testCreateBorrower
     * @covers \App\Borrower::getDetails
    */
    public function testBorrowerGetDetails($data)
    {
        fwrite(STDOUT, "\nExecuting testBorrowerGetDetails ...");
        $borrowerObject = new Borrower();
        $result = $borrowerObject->getDetails([],$data);
        $this->assertTrue($result['code'] == 200);
    }

Covered in the coverage report

   /**
     * @covers \App\UserType::getUserType
    */
    public function testGetUserType()
    {
        fwrite(STDOUT, "\nExecuting testGetUserType ...");
        $userTypeModel = new UserType();
        $faker = \Faker\Factory::create();
        $result = $userTypeModel->getUserType((object)['user_type_id'=>$faker->numberBetween(1,5)]);
        $this->assertNotNull($result);
        return $result;
    }

Both functions are same but 1 is working and another is not in coverage.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2YeKW5U
via IFTTT

Aucun commentaire:

Enregistrer un commentaire