Skip to content

Commit

Permalink
add e2e test to tests against codeception 5
Browse files Browse the repository at this point in the history
  • Loading branch information
sidz committed Oct 9, 2023
1 parent 05f4168 commit 5460118
Show file tree
Hide file tree
Showing 19 changed files with 3,659 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/e2e/Codeception_5/codeception.yml
@@ -0,0 +1,10 @@
paths:
tests: tests
output: tests/_output
data: tests/_data
support: tests/_support
envs: tests/_envs
actor_suffix: Tester
extensions:
enabled:
- Codeception\Extension\RunFailed
25 changes: 25 additions & 0 deletions tests/e2e/Codeception_5/composer.json
@@ -0,0 +1,25 @@
{
"require-dev": {
"codeception/codeception": "~5.0",
"codeception/module-asserts": "^3.0"
},
"autoload": {
"psr-4": {
"Codeception_5\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Codeception_5\\Test\\": "tests/"
}
},
"require": {
"infection/infection": "0.27.4",
"infection/codeception-adapter": "dev-master"
},
"config": {
"allow-plugins": {
"infection/extension-installer": true
}
}
}
9 changes: 9 additions & 0 deletions tests/e2e/Codeception_5/expected-output.txt
@@ -0,0 +1,9 @@
Total: 4

Killed: 3
Errored: 0
Syntax Errors: 0
Escaped: 1
Timed Out: 0
Skipped: 0
Not Covered: 0
11 changes: 11 additions & 0 deletions tests/e2e/Codeception_5/infection.json5
@@ -0,0 +1,11 @@
{
"$schema": "https://raw.githubusercontent.com/infection/infection/0.27.0/resources/schema.json",
"timeout": 25,
"source": {
"directories": [
"src"
]
},
"tmpDir": ".",
"testFramework": "codeception"
}
43 changes: 43 additions & 0 deletions tests/e2e/Codeception_5/run_tests.bash
@@ -0,0 +1,43 @@
#!/usr/bin/env bash

set -e

tputx () {
test -x $(which tput) && tput "$@"
}

run () {
local INFECTION=${1}
local PHPARGS=${2}

if [ "$DRIVER" = "phpdbg" ]
then
phpdbg $PHPARGS -qrr $INFECTION
else
php $PHPARGS $INFECTION
fi
}

cd "$(dirname "$0")"

git_branch=$(echo "${GITHUB_HEAD_REF:-$(git rev-parse --abbrev-ref HEAD)}" | sed 's/\//\\\//g')

echo "git_branch: ${git_branch}"

if [ "$git_branch" == "master" ]; then
exit 0;
fi;

sed -i "s/\"infection\/codeception-adapter\": \"dev-master\"/\"infection\/codeception-adapter\": \"dev-${git_branch}\"/" composer.json

set -e pipefail

rm -f composer.lock
composer install

run "vendor/bin/infection"

git checkout composer.json

diff -w expected-output.txt infection.log

13 changes: 13 additions & 0 deletions tests/e2e/Codeception_5/src/SourceClass.php
@@ -0,0 +1,13 @@
<?php

declare(strict_types=1);

namespace Codeception_5;

class SourceClass
{
public function add(float $a, float $b): float
{
return $a + $b;
}
}
Empty file.
Empty file.
26 changes: 26 additions & 0 deletions tests/e2e/Codeception_5/tests/_support/AcceptanceTester.php
@@ -0,0 +1,26 @@
<?php


/**
* Inherited Methods
* @method void wantToTest($text)
* @method void wantTo($text)
* @method void execute($callable)
* @method void expectTo($prediction)
* @method void expect($prediction)
* @method void amGoingTo($argumentation)
* @method void am($role)
* @method void lookForwardTo($achieveValue)
* @method void comment($description)
* @method void pause()
*
* @SuppressWarnings(PHPMD)
*/
class AcceptanceTester extends \Codeception\Actor
{
use _generated\AcceptanceTesterActions;

/**
* Define custom actions here
*/
}
26 changes: 26 additions & 0 deletions tests/e2e/Codeception_5/tests/_support/FunctionalTester.php
@@ -0,0 +1,26 @@
<?php


/**
* Inherited Methods
* @method void wantToTest($text)
* @method void wantTo($text)
* @method void execute($callable)
* @method void expectTo($prediction)
* @method void expect($prediction)
* @method void amGoingTo($argumentation)
* @method void am($role)
* @method void lookForwardTo($achieveValue)
* @method void comment($description)
* @method void pause()
*
* @SuppressWarnings(PHPMD)
*/
class FunctionalTester extends \Codeception\Actor
{
use _generated\FunctionalTesterActions;

/**
* Define custom actions here
*/
}
10 changes: 10 additions & 0 deletions tests/e2e/Codeception_5/tests/_support/Helper/Acceptance.php
@@ -0,0 +1,10 @@
<?php
namespace Helper;

// here you can define custom actions
// all public methods declared in helper class will be available in $I

class Acceptance extends \Codeception\Module
{

}
10 changes: 10 additions & 0 deletions tests/e2e/Codeception_5/tests/_support/Helper/Functional.php
@@ -0,0 +1,10 @@
<?php
namespace Helper;

// here you can define custom actions
// all public methods declared in helper class will be available in $I

class Functional extends \Codeception\Module
{

}
10 changes: 10 additions & 0 deletions tests/e2e/Codeception_5/tests/_support/Helper/Unit.php
@@ -0,0 +1,10 @@
<?php
namespace Helper;

// here you can define custom actions
// all public methods declared in helper class will be available in $I

class Unit extends \Codeception\Module
{

}
26 changes: 26 additions & 0 deletions tests/e2e/Codeception_5/tests/_support/UnitTester.php
@@ -0,0 +1,26 @@
<?php


/**
* Inherited Methods
* @method void wantToTest($text)
* @method void wantTo($text)
* @method void execute($callable)
* @method void expectTo($prediction)
* @method void expect($prediction)
* @method void amGoingTo($argumentation)
* @method void am($role)
* @method void lookForwardTo($achieveValue)
* @method void comment($description)
* @method void pause()
*
* @SuppressWarnings(PHPMD)
*/
class UnitTester extends \Codeception\Actor
{
use _generated\UnitTesterActions;

/**
* Define custom actions here
*/
}

0 comments on commit 5460118

Please sign in to comment.