diff --git a/.github/workflows/demo.yml b/.github/workflows/demo.yml
deleted file mode 100644
index 8391fb67..00000000
--- a/.github/workflows/demo.yml
+++ /dev/null
@@ -1,199 +0,0 @@
-# For details of what checks are run for PRs please refer below
-# docs: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
-name: DEMO
-
-# @TODO make this an integration test
-
-
-on:
- push:
- branches: ["master", "next"]
- paths:
- - '.github/workflows/demo.yml'
- - 'src/**'
- - 'demo/**'
- - 'composer.*'
- pull_request:
- paths:
- - '.github/workflows/demo.yml'
- - 'src/**'
- - 'demo/**'
- - 'composer.*'
- workflow_dispatch:
- schedule:
- # schedule weekly tests, since dependencies are not intended to be locked
- # this means: at 23:42 on Fridays
- - cron: '42 23 * * 5'
-
-concurrency:
- group: ${{ github.workflow }}-${{ github.ref }}
- cancel-in-progress: true
-
-env:
- PHP_VERSION_LATEST: "8.2"
- PHP_PROJECT_EXT: dom,filter,json,libxml # via `composer info -pt` and removed dev req
- REPORTS_DIR: CI_reports
- DEMO_TOOL_PATH: demo/.tool
- CDX_CP_TOOLS_VERSION_OVERRIDE: in-dev
- CDX_CP_TOOLS_EXCLUDE_LIBS: 1
- CDX_CP_TOOLS_EXCLUDE_COMPOSER: 1
-
-jobs:
- reproducible:
- name: >
- R: "${{ matrix.subject }}"
- (${{ matrix.spec-version }}
- ${{ matrix.output-format }},
- c${{ matrix.composer }}
- p${{ matrix.php }},
- i:${{ matrix.install }}
- stdout:${{ matrix.stdout }})
- runs-on: ubuntu-latest
- timeout-minutes: 10
- env:
- REPORTS_ARTIFACT: demo-reproducible
- strategy:
- fail-fast: false
- matrix:
- subject: # list of reproducible demos
- - devReq
- - laravel-7.12.0
- - local
- php:
- - "8.2" # latest
- - "8.1" # lowest supported
- composer:
- - "v2" # latest 2.x
- - "2.3" # latest 2.3 = lowest supported
- output-format:
- # lowercase the format, since it is also used as a file extension when searching the original file
- - xml
- - json
- spec-version:
- - "1.4"
- - "1.3"
- - "1.2"
- - "1.1"
- # - "1.0" # not implemented
- stdout: [ false ]
- install: [ true , false ]
- exclude:
- # exclude unsupported combinations: json is defined in spec >= 1.2
- - output-format: json
- spec-version: "1.0"
- - output-format: json
- spec-version: "1.1"
- include:
- - # test with the lowest combination
- php: "8.1" # lowest
- composer: "2.3" # lowest
- # any other props
- spec-version: "1.4"
- subject: laravel-7.12.0
- output-format: xml
- stdout: false
- - # test if STDOUT receives no data except the SBOM
- stdout: true # << the subject of this test-case
- php: "8.2" # latest
- composer: "v2" # latest
- spec-version: "1.4" # latest
- # any other props
- subject: laravel-7.12.0
- output-format: xml
- steps:
- - name: Checkout
- # see https://github.com/actions/checkout
- uses: actions/checkout@v4
- - name: Setup paths and folders
- run: |
- PWD="$(pwd -P)"
- OUT_FILE='${{ matrix.subject }}_php${{ matrix.php }}_composer${{ matrix.composer }}_bom.${{ matrix.spec-version }}.${{ matrix.output-format }}'
- COMPARE_FILE='bom.${{ matrix.spec-version }}.${{ matrix.output-format }}'
- DEMO_SUBJECT_DIR="$PWD"'/demo/${{ matrix.subject }}'
- echo "DEMO_PROJECT_DIR=$DEMO_SUBJECT_DIR/project" >> $GITHUB_ENV
- REPORTS_DIR_PATH="$PWD/$REPORTS_DIR"
- mkdir -p "$REPORTS_DIR_PATH"/'${{ matrix.subject }}'
- echo "REPORTS_DIR_PATH=$REPORTS_DIR_PATH" >> $GITHUB_ENV
- echo "OUT_FILE_PATH=$REPORTS_DIR_PATH/$OUT_FILE" >> $GITHUB_ENV
- echo "COMPARE_FILE_PATH=$DEMO_SUBJECT_DIR/results/$COMPARE_FILE" >> $GITHUB_ENV
- - name: Setup OMIT "dev"
- run: |
- OMIT_RULES=''
- if [ '${{ matrix.subject}}' != 'devReq' ]; then
- OMIT_RULES="$OMIT_RULES --omit=dev"
- fi
- echo "OMIT_RULES=$OMIT_RULES" >> $GITHUB_ENV
- - name: Setup PHP
- # see https://github.com/shivammathur/setup-php
- uses: shivammathur/setup-php@v2
- with:
- php-version: ${{ matrix.php }}
- extensions: ${{ env.PHP_PROJECT_EXT }}
- tools: composer:${{ matrix.composer }}
- coverage: none
- - name: Get composer cache directory
- id: composer-cache
- working-directory: ${{ env.DEMO_PROJECT_DIR }}
- shell: bash
- run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- - name: Cache dependencies
- if: ${{ steps.composer-cache.outputs.dir }}
- # see https://github.com/actions/cache
- uses: actions/cache@v3
- with:
- path: ${{ steps.composer-cache.outputs.dir }}
- key: composer-${{ github.job }}-${{ matrix.subject }}-php${{ matrix.php }}-${{ hashFiles('composer.*', 'demo/*/project/composer.*') }}
- restore-keys: |
- composer-${{ github.job }}-${{ matrix.subject }}-php${{ matrix.php }}-
- composer-${{ github.job }}-${{ matrix.subject }}-
- - name: Install composer plugin
- working-directory: ${{ env.DEMO_TOOL_PATH }}
- run: composer install
- - name: Install project dependencies & kick lockfile
- if: ${{ matrix.install }}
- working-directory: ${{ env.DEMO_PROJECT_DIR }}
- run: |
- composer setup
- rm composer.lock
- - name: Make SBOM to file
- if: ${{ ! matrix.stdout }}
- working-directory: ${{ env.DEMO_TOOL_PATH }}
- run: >
- composer CycloneDX:make-sbom
- -vvv
- $OMIT_RULES
- --validate
- --spec-version=${{ matrix.spec-version }}
- --output-reproducible
- --output-format=${{ matrix.output-format }}
- --output-file="$OUT_FILE_PATH"
- --
- ${{ env.DEMO_PROJECT_DIR }}/composer.json
- - name: Make SBOM to STDOUT
- if: ${{ matrix.stdout }}
- working-directory: ${{ env.DEMO_TOOL_PATH }}
- run: >
- composer CycloneDX:make-sbom
- -vvv
- $OMIT_RULES
- --validate
- --spec-version=${{ matrix.spec-version }}
- --output-reproducible
- --output-format=${{ matrix.output-format }}
- --output-file=-
- --
- ${{ env.DEMO_PROJECT_DIR }}/composer.json
- > "$OUT_FILE_PATH"
- - name: Compare reproducible SBOM
- run: >
- diff -s
- "$COMPARE_FILE_PATH"
- "$OUT_FILE_PATH"
- - name: Artifact reports
- if: ${{ failure() }}
- # see https://github.com/actions/upload-artifact
- uses: actions/upload-artifact@v3
- with:
- name: ${{ env.REPORTS_ARTIFACT }}-failed
- path: ${{ env.REPORTS_DIR }}
- if-no-files-found: error
diff --git a/.gitignore b/.gitignore
index 82ea0ca3..bdb1e0a4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -20,4 +20,4 @@
/CI_reports/
# general temp dir - utilized during tests for reasons
-/.tmp/
+.tmp/
diff --git a/demo/create-sbom-results.sh b/demo/create-sbom-results.sh
deleted file mode 100755
index 981b8448..00000000
--- a/demo/create-sbom-results.sh
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/sh
-set -ex
-
-THIS_DIR="$(dirname "$0")"
-
-COMPOSER_BIN="${COMPOSER_BIN:-$(which composer)}"
-
-find "$THIS_DIR" -mindepth 2 -maxdepth 2 -type d -name 'project' \
--print \
--exec "$COMPOSER_BIN" -d '{}' setup \; \
--exec "$COMPOSER_BIN" -d '{}' create-sbom-results -vv \;
diff --git a/demo/devReq/results/bom.1.4.json b/demo/devReq/results/bom.1.4.json
index d57d9edc..774eb798 100644
--- a/demo/devReq/results/bom.1.4.json
+++ b/demo/devReq/results/bom.1.4.json
@@ -8,28 +8,7 @@
{
"vendor": "cyclonedx",
"name": "cyclonedx-php-composer",
- "version": "in-dev",
- "externalReferences": [
- {
- "type": "distribution",
- "url": "../.."
- },
- {
- "type": "website",
- "url": "https://github.com/CycloneDX/cyclonedx-php-composer/#readme",
- "comment": "as detected from Composer manifest 'homepage'"
- },
- {
- "type": "issue-tracker",
- "url": "https://github.com/CycloneDX/cyclonedx-php-composer/issues",
- "comment": "as detected from Composer manifest 'support.issues'"
- },
- {
- "type": "vcs",
- "url": "https://github.com/CycloneDX/cyclonedx-php-composer/",
- "comment": "as detected from Composer manifest 'support.source'"
- }
- ]
+ "version": "in-dev"
}
],
"component": {
diff --git a/demo/devReq/results/bom.1.4.xml b/demo/devReq/results/bom.1.4.xml
index 055526fe..2f3d87bd 100644
--- a/demo/devReq/results/bom.1.4.xml
+++ b/demo/devReq/results/bom.1.4.xml
@@ -6,23 +6,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/demo/devReq/results/bom.1.5.json b/demo/devReq/results/bom.1.5.json
index 56c7460e..ab787ab2 100644
--- a/demo/devReq/results/bom.1.5.json
+++ b/demo/devReq/results/bom.1.5.json
@@ -8,28 +8,7 @@
{
"vendor": "cyclonedx",
"name": "cyclonedx-php-composer",
- "version": "in-dev",
- "externalReferences": [
- {
- "type": "distribution",
- "url": "../.."
- },
- {
- "type": "website",
- "url": "https://github.com/CycloneDX/cyclonedx-php-composer/#readme",
- "comment": "as detected from Composer manifest 'homepage'"
- },
- {
- "type": "issue-tracker",
- "url": "https://github.com/CycloneDX/cyclonedx-php-composer/issues",
- "comment": "as detected from Composer manifest 'support.issues'"
- },
- {
- "type": "vcs",
- "url": "https://github.com/CycloneDX/cyclonedx-php-composer/",
- "comment": "as detected from Composer manifest 'support.source'"
- }
- ]
+ "version": "in-dev"
}
],
"component": {
diff --git a/demo/devReq/results/bom.1.5.xml b/demo/devReq/results/bom.1.5.xml
index d1b9bc8b..0d6a5e25 100644
--- a/demo/devReq/results/bom.1.5.xml
+++ b/demo/devReq/results/bom.1.5.xml
@@ -6,23 +6,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/demo/laravel-7.12.0/results/bom.1.4.json b/demo/laravel-7.12.0/results/bom.1.4.json
index bfd3f2a6..c8306c84 100644
--- a/demo/laravel-7.12.0/results/bom.1.4.json
+++ b/demo/laravel-7.12.0/results/bom.1.4.json
@@ -8,28 +8,7 @@
{
"vendor": "cyclonedx",
"name": "cyclonedx-php-composer",
- "version": "in-dev",
- "externalReferences": [
- {
- "type": "distribution",
- "url": "../.."
- },
- {
- "type": "website",
- "url": "https://github.com/CycloneDX/cyclonedx-php-composer/#readme",
- "comment": "as detected from Composer manifest 'homepage'"
- },
- {
- "type": "issue-tracker",
- "url": "https://github.com/CycloneDX/cyclonedx-php-composer/issues",
- "comment": "as detected from Composer manifest 'support.issues'"
- },
- {
- "type": "vcs",
- "url": "https://github.com/CycloneDX/cyclonedx-php-composer/",
- "comment": "as detected from Composer manifest 'support.source'"
- }
- ]
+ "version": "in-dev"
}
],
"component": {
diff --git a/demo/laravel-7.12.0/results/bom.1.4.xml b/demo/laravel-7.12.0/results/bom.1.4.xml
index 0e24ae41..80386bc1 100644
--- a/demo/laravel-7.12.0/results/bom.1.4.xml
+++ b/demo/laravel-7.12.0/results/bom.1.4.xml
@@ -6,23 +6,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/demo/laravel-7.12.0/results/bom.1.5.json b/demo/laravel-7.12.0/results/bom.1.5.json
index 92a69a54..a62281a4 100644
--- a/demo/laravel-7.12.0/results/bom.1.5.json
+++ b/demo/laravel-7.12.0/results/bom.1.5.json
@@ -8,28 +8,7 @@
{
"vendor": "cyclonedx",
"name": "cyclonedx-php-composer",
- "version": "in-dev",
- "externalReferences": [
- {
- "type": "distribution",
- "url": "../.."
- },
- {
- "type": "website",
- "url": "https://github.com/CycloneDX/cyclonedx-php-composer/#readme",
- "comment": "as detected from Composer manifest 'homepage'"
- },
- {
- "type": "issue-tracker",
- "url": "https://github.com/CycloneDX/cyclonedx-php-composer/issues",
- "comment": "as detected from Composer manifest 'support.issues'"
- },
- {
- "type": "vcs",
- "url": "https://github.com/CycloneDX/cyclonedx-php-composer/",
- "comment": "as detected from Composer manifest 'support.source'"
- }
- ]
+ "version": "in-dev"
}
],
"component": {
diff --git a/demo/laravel-7.12.0/results/bom.1.5.xml b/demo/laravel-7.12.0/results/bom.1.5.xml
index 983b278a..7eaaee76 100644
--- a/demo/laravel-7.12.0/results/bom.1.5.xml
+++ b/demo/laravel-7.12.0/results/bom.1.5.xml
@@ -6,23 +6,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/demo/local/results/bom.1.4.json b/demo/local/results/bom.1.4.json
index b711b145..12a958d5 100644
--- a/demo/local/results/bom.1.4.json
+++ b/demo/local/results/bom.1.4.json
@@ -8,28 +8,7 @@
{
"vendor": "cyclonedx",
"name": "cyclonedx-php-composer",
- "version": "in-dev",
- "externalReferences": [
- {
- "type": "distribution",
- "url": "../.."
- },
- {
- "type": "website",
- "url": "https://github.com/CycloneDX/cyclonedx-php-composer/#readme",
- "comment": "as detected from Composer manifest 'homepage'"
- },
- {
- "type": "issue-tracker",
- "url": "https://github.com/CycloneDX/cyclonedx-php-composer/issues",
- "comment": "as detected from Composer manifest 'support.issues'"
- },
- {
- "type": "vcs",
- "url": "https://github.com/CycloneDX/cyclonedx-php-composer/",
- "comment": "as detected from Composer manifest 'support.source'"
- }
- ]
+ "version": "in-dev"
}
],
"component": {
diff --git a/demo/local/results/bom.1.4.xml b/demo/local/results/bom.1.4.xml
index 9c4384af..46f21292 100644
--- a/demo/local/results/bom.1.4.xml
+++ b/demo/local/results/bom.1.4.xml
@@ -6,23 +6,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/demo/local/results/bom.1.5.json b/demo/local/results/bom.1.5.json
index 626a3417..d5559ff4 100644
--- a/demo/local/results/bom.1.5.json
+++ b/demo/local/results/bom.1.5.json
@@ -8,28 +8,7 @@
{
"vendor": "cyclonedx",
"name": "cyclonedx-php-composer",
- "version": "in-dev",
- "externalReferences": [
- {
- "type": "distribution",
- "url": "../.."
- },
- {
- "type": "website",
- "url": "https://github.com/CycloneDX/cyclonedx-php-composer/#readme",
- "comment": "as detected from Composer manifest 'homepage'"
- },
- {
- "type": "issue-tracker",
- "url": "https://github.com/CycloneDX/cyclonedx-php-composer/issues",
- "comment": "as detected from Composer manifest 'support.issues'"
- },
- {
- "type": "vcs",
- "url": "https://github.com/CycloneDX/cyclonedx-php-composer/",
- "comment": "as detected from Composer manifest 'support.source'"
- }
- ]
+ "version": "in-dev"
}
],
"component": {
diff --git a/demo/local/results/bom.1.5.xml b/demo/local/results/bom.1.5.xml
index 0d8e7b1c..36738ec5 100644
--- a/demo/local/results/bom.1.5.xml
+++ b/demo/local/results/bom.1.5.xml
@@ -6,23 +6,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/MakeBom/Command.php b/src/MakeBom/Command.php
index a04388fb..9e7061d0 100644
--- a/src/MakeBom/Command.php
+++ b/src/MakeBom/Command.php
@@ -234,7 +234,7 @@ private function writeBom(string $bom, IOInterface $io): void
$outputFile = $this->options->outputFile;
$outputStream = Options::VALUE_OUTPUT_FILE_STDOUT === $outputFile
? \STDOUT
- : fopen($outputFile, 'wb');
+ : @fopen($outputFile, 'wb');
if (false === $outputStream) {
throw new Errors\OutputError("failed to open output: $outputFile");
}
diff --git a/tests/PluginTest.php b/tests/Functional/PluginTest.php
similarity index 97%
rename from tests/PluginTest.php
rename to tests/Functional/PluginTest.php
index 5a37b406..897a4292 100644
--- a/tests/PluginTest.php
+++ b/tests/Functional/PluginTest.php
@@ -21,7 +21,7 @@
* Copyright (c) OWASP Foundation. All Rights Reserved.
*/
-namespace CycloneDX\Tests;
+namespace CycloneDX\Tests\Functional;
use Composer\Plugin\Capability\CommandProvider;
use Composer\Plugin\Capable;
@@ -44,7 +44,7 @@ final class PluginTest extends TestCase
/**
* path to composer.json file.
*/
- private const COMPOSER_JSON_FILE_PATH = __DIR__.'/../composer.json';
+ private const COMPOSER_JSON_FILE_PATH = __DIR__.'/../../composer.json';
/**
* assert the correct setup as described in
diff --git a/tests/Integration/CommandMakeSbomAsExpectedTest.php b/tests/Integration/CommandMakeSbomAsExpectedTest.php
new file mode 100644
index 00000000..7f671b4b
--- /dev/null
+++ b/tests/Integration/CommandMakeSbomAsExpectedTest.php
@@ -0,0 +1,107 @@
+ 'CycloneDX:make-sbom',
+ '--output-format' => $outputFormat,
+ '--spec-version' => $specV,
+ '--output-reproducible' => true,
+ '--validate' => true,
+ '--output-file' => $outFile,
+ '--omit' => $omit,
+ 'composer-file' => $composeFile,
+ ]);
+ $out = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL);
+ $app = self::make_app((new Plugin())->getCommands()[0]);
+
+ $exitCode = $app->run($in, $out);
+
+ self::assertSame(0, $exitCode, $out->fetch());
+
+ if ('1' === getenv('CDX_CP_TESTS_UPDATE_SNAPSHOTS')) {
+ copy($outFile, $expectedSbomFile);
+ }
+ self::assertFileEquals($expectedSbomFile, $outFile);
+ }
+
+ public static function dp(): Generator
+ {
+ foreach (['devReq', 'laravel-7.12.0', 'local'] as $purpose) {
+ foreach (['json', 'xml'] as $outputFormat) {
+ $specVs = ['1.5', '1.4', '1.3', '1.2'];
+ if ('xml' === $outputFormat) {
+ $specVs[] = '1.1';
+ }
+ foreach ($specVs as $specV) {
+ $composeFile = self::DEMO_ROOT."/$purpose/project/composer.json";
+ $snapshotFile = self::DEMO_ROOT."/$purpose/results/bom.$specV.$outputFormat";
+ yield "demo: $purpose $outputFormat $specV" => [
+ $outputFormat,
+ $specV,
+ $composeFile,
+ 'devReq' === $purpose ? [] : ['dev'],
+ $snapshotFile,
+ ];
+ }
+ }
+ }
+ }
+}
diff --git a/tests/Integration/CommandMakeSbomFailsTest.php b/tests/Integration/CommandMakeSbomFailsTest.php
new file mode 100644
index 00000000..fb31739a
--- /dev/null
+++ b/tests/Integration/CommandMakeSbomFailsTest.php
@@ -0,0 +1,79 @@
+ 'CycloneDX:make-sbom',
+ '--output-file' => $outFile,
+ ...$input,
+ ]);
+ $out = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL);
+ $app = self::make_app((new Plugin())->getCommands()[0]);
+
+ $exitCode = $app->run($in, $out);
+
+ self::assertGreaterThan(0, $exitCode);
+ self::assertStringContainsString($expectedOutput, $out->fetch());
+ }
+
+ public static function dp(): Generator
+ {
+ yield 'unexpected options' => [
+ ['--spec-version' => '1.foo'],
+ 'Invalid value for option "spec-version"',
+ ];
+ yield 'no composer-file' => [
+ ['composer-file' => self::DEMO_ROOT.'/does-not-exist/project/composer.json'],
+ 'could not find the config file: '.self::DEMO_ROOT.'/does-not-exist/project/composer.json',
+ ];
+ yield 'not possible target-file' => [
+ [
+ '--output-file' => self::DEMO_ROOT.'/does-not-exist/result/bom',
+ 'composer-file' => self::DEMO_ROOT.'/laravel-7.12.0/project/composer.json',
+ ],
+ 'failed to open output: '.self::DEMO_ROOT.'/does-not-exist/result/bom',
+ ];
+ }
+}
diff --git a/tests/Integration/CommandMakeSbomTest.php b/tests/Integration/CommandMakeSbomTest.php
new file mode 100644
index 00000000..04268389
--- /dev/null
+++ b/tests/Integration/CommandMakeSbomTest.php
@@ -0,0 +1,85 @@
+ 'CycloneDX:make-sbom',
+ ...$input,
+ '--output-file' => $outFile,
+ 'composer-file' => self::DEMO_ROOT.'/laravel-7.12.0/project/composer.json',
+ ]);
+ $out = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL);
+ $app = self::make_app((new Plugin())->getCommands()[0]);
+
+ $exitCode = $app->run($in, $out);
+
+ self::assertSame(0, $exitCode);
+ self::assertStringContainsString($expectedOutput, file_get_contents($outFile));
+ }
+
+ public static function dp(): Generator
+ {
+ yield 'not reproducible defaults to XML 1.4 with serialnumber' => [
+ ['--output-reproducible' => false],
+ '
+
+
+ XML,
+ ];
+ yield 'no validate JSON' => [
+ ['--output-format' => 'json', '--validate' => false],
+ '{',
+ ];
+ yield 'no validate XML' => [
+ ['--output-format' => 'xml', '--validate' => false],
+ '<',
+ ];
+ }
+}
diff --git a/tests/Integration/CommandTestCase.php b/tests/Integration/CommandTestCase.php
new file mode 100644
index 00000000..5b909a61
--- /dev/null
+++ b/tests/Integration/CommandTestCase.php
@@ -0,0 +1,42 @@
+add($command);
+ $app->setAutoExit(false);
+
+ return $app;
+ }
+}
diff --git a/tests/MakeBom/BuilderTest.php b/tests/Unit/MakeBom/BuilderTest.php
similarity index 98%
rename from tests/MakeBom/BuilderTest.php
rename to tests/Unit/MakeBom/BuilderTest.php
index 545c01b9..84d52e01 100644
--- a/tests/MakeBom/BuilderTest.php
+++ b/tests/Unit/MakeBom/BuilderTest.php
@@ -21,7 +21,7 @@
* Copyright (c) OWASP Foundation. All Rights Reserved.
*/
-namespace CycloneDX\Tests\MakeBom;
+namespace CycloneDX\Tests\Unit\MakeBom;
use Composer\Factory as ComposerFactory;
use Composer\IO\NullIO;
@@ -395,7 +395,7 @@ public static function dpCreateToolsFromComposer(): Generator
*/
private static function getTempDir(): string
{
- $tempSetupDir = __DIR__.'/../../.tmp/BuilderTest/setup';
+ $tempSetupDir = __DIR__.'/../../../.tmp/BuilderTest/setup';
if (is_dir($tempSetupDir) || mkdir($tempSetupDir, recursive: true)) {
return $tempSetupDir;
}
@@ -407,8 +407,8 @@ private static function getTempDir(): string
*/
private static function dpForSetup(string $setupTemplate, bool $createNoDev): Generator
{
- $setupManifest = __DIR__."/../_data/setup/$setupTemplate/composer.json";
- $setupLock = __DIR__."/../_data/setup/$setupTemplate/composer.lock";
+ $setupManifest = __DIR__."/../../_data/setup/$setupTemplate/composer.json";
+ $setupLock = __DIR__."/../../_data/setup/$setupTemplate/composer.lock";
yield 'locked NotInstalled' => [
static fn () => $setupManifest,
diff --git a/tests/MakeBom/OptionsTest.php b/tests/Unit/MakeBom/OptionsTest.php
similarity index 99%
rename from tests/MakeBom/OptionsTest.php
rename to tests/Unit/MakeBom/OptionsTest.php
index 29bb0c94..1f54ea43 100644
--- a/tests/MakeBom/OptionsTest.php
+++ b/tests/Unit/MakeBom/OptionsTest.php
@@ -21,7 +21,7 @@
* Copyright (c) OWASP Foundation. All Rights Reserved.
*/
-namespace CycloneDX\Tests\MakeBom;
+namespace CycloneDX\Tests\Unit\MakeBom;
use CycloneDX\Composer\MakeBom\Options;
use CycloneDX\Core\Spec\Format;