Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task: minor behat test cleanup #3175

Merged
merged 7 commits into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,14 @@
"description": "Flow packages in a joined repository for pull requests.",
"license": ["MIT"],
"type": "neos-package-collection",
"scripts": {
"test:behavioral": [
"../../flow doctrine:migrate --quiet",
"../../bin/behat -f progress -c Neos.Flow/Tests/Behavior/behat.yml"
]
},
"require": {
"behat/behat": "^3.5"
},
"replace": {
},
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ jobs:
if: ${{ matrix.static-analysis == 'no' && matrix.dependencies != 'lowest' }}
#if: env.BEHAT == true
run: |
FLOW_CONTEXT=Testing/Behat ./flow behat:setup && ./flow doctrine:create && ./flow doctrine:migrationversion --add --version all
bin/behat --stop-on-failure -f progress -c Packages/Framework/Neos.Flow/Tests/Behavior/behat.yml.dist
cd Packages/Framework
composer test:behavioral

- name: Setup Flow configuration (PGSQL)
run: |
Expand Down Expand Up @@ -222,8 +222,8 @@ jobs:
if: ${{ matrix.static-analysis == 'no' && matrix.dependencies != 'lowest' }}
#if: env.BEHAT == true
run: |
FLOW_CONTEXT=Testing/Behat ./flow behat:setup && ./flow doctrine:create && ./flow doctrine:migrationversion --add --version all
bin/behat --stop-on-failure -f progress -c Packages/Framework/Neos.Flow/Tests/Behavior/behat.yml.dist
cd Packages/Framework
composer test:behavioral

buildall:
if: "!contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[skip travis]')"
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/experimental.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ jobs:
if: ${{ matrix.static-analysis == 'no' && matrix.dependencies != 'lowest' }}
#if: env.BEHAT == true
run: |
FLOW_CONTEXT=Testing/Behat ./flow behat:setup && ./flow doctrine:create && ./flow doctrine:migrationversion --add --version all
bin/behat --stop-on-failure -f progress -c Packages/Framework/Neos.Flow/Tests/Behavior/behat.yml.dist
cd Packages/Framework
composer test:behavioral

- name: Setup Flow configuration (PGSQL)
run: |
Expand Down Expand Up @@ -206,5 +206,5 @@ jobs:
if: ${{ matrix.static-analysis == 'no' && matrix.dependencies != 'lowest' }}
#if: env.BEHAT == true
run: |
FLOW_CONTEXT=Testing/Behat ./flow behat:setup && ./flow doctrine:create && ./flow doctrine:migrationversion --add --version all
bin/behat --stop-on-failure -f progress -c Packages/Framework/Neos.Flow/Tests/Behavior/behat.yml.dist
cd Packages/Framework
composer test:behavioral
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ protected function setupSecurity()
return;
}
$this->privilegeManager = $this->objectManager->get(PrivilegeManagerInterface::class);
$this->privilegeManager->setOverrideDecision(null);
$this->privilegeManager->reset();

$this->policyService = $this->objectManager->get(PolicyService::class);
$this->accountRepository = $this->objectManager->get(Security\AccountRepository::class);
Expand Down
9 changes: 9 additions & 0 deletions Neos.Flow/Tests/Behavior/behat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
default:
autoload:
'': "%paths.base%/Features/Bootstrap"
suites:
flow:
paths:
- "%paths.base%/Features/Security"
contexts:
- FeatureContext
27 changes: 0 additions & 27 deletions Neos.Flow/Tests/Behavior/behat.yml.dist

This file was deleted.

51 changes: 6 additions & 45 deletions Neos.Flow/Tests/Functional/Command/BehatTestHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,11 @@
require_once(FLOW_PATH_PACKAGES . '/Framework/Neos.Flow/Tests/Behavior/Features/Bootstrap/IsolatedBehatStepsTrait.php');
require_once(FLOW_PATH_PACKAGES . '/Framework/Neos.Flow/Tests/Behavior/Features/Bootstrap/SecurityOperationsTrait.php');

use Neos\Flow\Tests\Behavior\Features\Bootstrap\IsolatedBehatStepsTrait;
use Neos\Flow\Tests\Behavior\Features\Bootstrap\SecurityOperationsTrait;
use Neos\Flow\Annotations as Flow;
use Neos\Flow\Core\Bootstrap;
use Neos\Flow\Mvc\ActionRequest;
use Neos\Flow\ObjectManagement\ObjectManagerInterface;
use Neos\Flow\Security\Authentication\AuthenticationManagerInterface;
use Neos\Flow\Security\Authentication\Provider\TestingProvider;
use Neos\Flow\Security\Authorization\PrivilegeManagerInterface;
use Neos\Flow\Security\Context;
use Neos\Flow\Security\Policy\PolicyService;
use Neos\Flow\Tests\Behavior\Features\Bootstrap\SecurityOperationsTrait;
use Neos\Flow\Utility\Environment;

/**
Expand All @@ -35,13 +29,11 @@
*/
class BehatTestHelper
{
use IsolatedBehatStepsTrait;

use SecurityOperationsTrait;

/**
* @var Bootstrap
*/
protected $isolated = false;
mhsdesign marked this conversation as resolved.
Show resolved Hide resolved

/** @var Bootstrap */
protected static $bootstrap;

/**
Expand All @@ -56,49 +48,18 @@ class BehatTestHelper
*/
protected $environment;

/**
* @var ActionRequest
*/
protected $mockActionRequest;

/**
* @var PrivilegeManagerInterface
*/
protected $privilegeManager;

/**
* @var PolicyService
* @Flow\Inject
*/
protected $policyService;

/**
* @var AuthenticationManagerInterface
*/
protected $authenticationManager;

/**
* @var TestingProvider
*/
protected $testingProvider;

/**
* @var Context
*/
protected $securityContext;

/**
* @return void
*/
public function initializeObject()
public function initializeObject(): void
{
self::$bootstrap = Bootstrap::$staticObjectManager->get(Bootstrap::class);
$this->isolated = false;
}

/**
* @return mixed
*/
/** @return ObjectManagerInterface */
protected function getObjectManager()
{
return $this->objectManager;
Expand Down
8 changes: 8 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@
"MIT"
],
"type": "neos-package-collection",
"scripts": {
"test:behavioral": [
"../../flow doctrine:migrate --quiet",
"../../bin/behat -f progress -c Neos.Flow/Tests/Behavior/behat.yml"
]
},
"require": {
"behat/behat": "^3.5",
"php": "^8.2",
"psr/simple-cache": "^2.0 || ^3.0",
"psr/cache": "^2.0 || ^3.0",
Expand All @@ -22,6 +29,7 @@
"psr/http-server-handler": "^1.0",
"psr/http-client": "^1.0",
"ramsey/uuid": "^3.0 || ^4.0",
"laminas/laminas-code": "^4.10",
"doctrine/orm": "^2.12.0",
"doctrine/migrations": "^3.0",
"doctrine/dbal": "^2.13",
Expand Down