Giter VIP home page Giter VIP logo

Comments (6)

erolatex avatar erolatex commented on June 12, 2024

Works as expected up to version 5.0.6, but encountering issues starting from 5.0.7

from codeception.

erolatex avatar erolatex commented on June 12, 2024

Looks like broken in #6623

from codeception.

popovous avatar popovous commented on June 12, 2024

same for me

from codeception.

artemtimac92 avatar artemtimac92 commented on June 12, 2024

Yes, the same issue after upgrade. Could you please fix it ASAP?

from codeception.

zyab1ik avatar zyab1ik commented on June 12, 2024

The same issue for me, could check it pls?

from codeception.

craig-mcmahon avatar craig-mcmahon commented on June 12, 2024

I am having the same issue.

The following test code will fail test2 with the failure from test1

<?php

namespace Tests\Unit;

use Codeception\Test\Unit;
use PHPUnit\Framework\AssertionFailedError;
use Tests\Support\UnitTester;

class TestTest extends Unit {

	protected UnitTester $tester;

	public function test1(){
		static::fail(':-(');
	}

	public function test2(){
		$this->expectException(AssertionFailedError::class);
		$this->tester->assertFalse(true);
	}

}

Using the phpunit assertions in test2 instead of the Assert module will show the test passed as expected

I have identified the source of the failure in Codeception\Test\Test line from 172

if (method_exists($this, 'getScenario')) {
    foreach ($this->getScenario()?->getSteps() ?? [] as $step) {
        if ($step->hasFailed()) {
            $lastFailure = $result->popLastFailure();
            if ($lastFailure !== null) {
                throw $lastFailure->getFail();
            }
        }
    }
}

The line from test2 $this->tester->assertFalse(true); causes a scenario step to fail, but the test succeeds as the exception was expected.
The code from Codeception\Test\Test then sees the scenario step has failed, and then grabs the last test failure to report which is from a different test

from codeception.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.