Skip to content
Closed
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
8 changes: 6 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,17 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [ '8.2', '8.3', '8.4' ]
phpunit-version: [ '10.5', '11.5', '12.4' ]
php: [ '8.1', '8.2', '8.3', '8.4' ]
phpunit-version: ['9.5', '10.5', '11.5', '12.4' ]
exclude:
- php: '8.4'
phpunit-version: '10.5'
- php: '8.4'
phpunit-version: '9.5'
- php: '8.2'
phpunit-version: '12.4'
- php: '8.1'
phpunit-version: '12.4'
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .php-cs-fixer.cache
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"php":"8.2.29","version":"3.90.0:v3.90.0#ad732c2e9299c9743f9c55ae53cc0e7642ab1155","indent":" ","lineEnding":"\n","rules":{"binary_operator_spaces":{"default":"at_least_single_space"},"blank_line_after_opening_tag":true,"blank_line_between_import_groups":true,"blank_lines_before_namespace":true,"braces_position":{"allow_single_line_empty_anonymous_classes":true},"class_definition":{"inline_constructor_arguments":false,"space_before_parenthesis":true},"compact_nullable_type_declaration":true,"declare_equal_normalize":true,"lowercase_cast":true,"lowercase_static_reference":true,"modifier_keywords":true,"new_with_parentheses":{"anonymous_class":true},"no_blank_lines_after_class_opening":true,"no_extra_blank_lines":{"tokens":["use"]},"no_leading_import_slash":true,"no_whitespace_in_blank_line":true,"ordered_class_elements":{"order":["use_trait"]},"ordered_imports":{"imports_order":["class","function","const"],"sort_algorithm":"none"},"return_type_declaration":true,"short_scalar_cast":true,"single_import_per_statement":{"group_to_single_imports":false},"single_space_around_construct":{"constructs_followed_by_a_single_space":["abstract","as","case","catch","class","const_import","do","else","elseif","final","finally","for","foreach","function","function_import","if","insteadof","interface","namespace","new","private","protected","public","static","switch","trait","try","use","use_lambda","while"],"constructs_preceded_by_a_single_space":["as","else","elseif","use_lambda"]},"single_trait_insert_per_statement":true,"ternary_operator_spaces":true,"unary_operator_spaces":{"only_dec_inc":true},"blank_line_after_namespace":true,"constant_case":true,"control_structure_braces":true,"control_structure_continuation_position":true,"elseif":true,"function_declaration":{"closure_fn_spacing":"one"},"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"method_argument_space":{"after_heredoc":true},"no_break_comment":true,"no_closing_tag":true,"no_multiple_statements_per_line":true,"no_space_around_double_colon":true,"no_spaces_after_function_name":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_class_element_per_statement":{"elements":["property"]},"single_line_after_imports":true,"spaces_inside_parentheses":true,"statement_indentation":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"encoding":true,"full_opening_tag":true,"octal_notation":true,"clean_namespace":true,"no_unset_cast":true,"assign_null_coalescing_to_coalesce_equal":true,"normalize_index_brace":true,"heredoc_indentation":true,"no_whitespace_before_comma_in_array":{"after_heredoc":true},"trailing_comma_in_multiline":{"after_heredoc":true},"list_syntax":true,"ternary_to_null_coalescing":true,"array_syntax":true,"no_unused_imports":true,"fully_qualified_strict_types":true},"hashes":{"src\/Command\/Router.php":"b2a306bfe90da3e771413b8dea77f416","src\/Command\/ServeCommand.php":"4c45cbcf7c8fe646c68c1ec35d9a4984","src\/Command\/RouterInterface.php":"857c4c498de00c34e01b83ab26b626c2","src\/Coverage\/Coverage.php":"73ff8293849648e1a2100158f75feb39","src\/Util\/Composer.php":"0ece8bbf75bbb97e7d0a583404824538","src\/PHPUnit\/PhpUnitHubExtension.php":"6e23b8845965ecfa033c74078508ffb6","src\/Discoverer\/TestDiscoverer.php":"26db9dbb92284349b05b7320d1250a6f","src\/Parser\/JUnitParser.php":"1a064753b2a0cf80b35c2c6131b3407d","src\/WebSocket\/StatusHandler.php":"e65bbba93f1f1c8bb116140370023aa1","src\/Http\/DecoratedHttpServer.php":"796efd5b1f3413200c4216eacd07baf4","src\/TestRunner\/TestRunner.php":"1ddbf207ccb2a53d2e0674775fa7d074","tests\/Command\/RouterTest.php":"64de0dd90223ca85ef11ab21d9e9f624","tests\/Command\/ServeCommandTest.php":"98e0865c6fd11eb3726bf182e37012e7","tests\/Coverage\/CoverageTest.php":"2f7938f8f414ceb10d8d3b80264fd675","tests\/Discoverer\/TestDiscovererTest.php":"a4354743436349d6c8fdde06e9f3e969","tests\/Parser\/JUnitParserTest.php":"ac9265156b4482b074eef22a06fbd604","tests\/WebSocket\/StatusHandlerTest.php":"532eaf4611becdc32d805efc6411f665","tests\/TestRunner\/TestRunnerTest.php":"f9945b179ecc18a986fd81ad0a4278d8","src\/Util\/ProjectRootResolver.php":"cfc86290611994f3efe9355e84ae4049","src\/PHPUnit\/TestSubscriber.php":"15b9ac0382ea6e9ec64132f357a19076","src\/Discoverer\/PhpUnitCommandExecutor.php":"eda5d8493de9db65695d45770a768efc","tests\/Util\/ProjectRootResolverTest.php":"b77b8208c37629acedd90b4b675f761e","tests\/Util\/ComposerTest.php":"d9c61117c9f424c3bd45724c13a9ef87","tests\/PHPUnit\/TestSubscriberTest.php":"c0ee01fba41bedcd24f36a84baa71191","tests\/Http\/DecoratedHttpServerTest.php":"eca8426406a227d192f817bac2853cb2","src\/Util\/PhpUnitCommandExecutor.php":"84274486bc5836d4dfa6a15ae4711dcc","tests\/Util\/PhpUnitCommandExecutorTest.php":"2f9d8ada0f682222427c4e5689e88d98","tests\/Command\/RouterNewTest.php":"f0925a34a802304469d530db333ea8ef"}}
{"php":"8.2.29","version":"3.91.2:v3.91.2#f171dc216bc8a4192d5a0876a899cce6f9e379d6","indent":" ","lineEnding":"\n","rules":{"binary_operator_spaces":{"default":"at_least_single_space"},"blank_line_after_opening_tag":true,"blank_line_between_import_groups":true,"blank_lines_before_namespace":true,"braces_position":{"allow_single_line_empty_anonymous_classes":true},"class_definition":{"inline_constructor_arguments":false,"space_before_parenthesis":true},"compact_nullable_type_declaration":true,"declare_equal_normalize":true,"lowercase_cast":true,"lowercase_static_reference":true,"modifier_keywords":true,"new_with_parentheses":{"anonymous_class":true},"no_blank_lines_after_class_opening":true,"no_extra_blank_lines":{"tokens":["use"]},"no_leading_import_slash":true,"no_whitespace_in_blank_line":true,"ordered_class_elements":{"order":["use_trait"]},"ordered_imports":{"imports_order":["class","function","const"],"sort_algorithm":"none"},"return_type_declaration":true,"short_scalar_cast":true,"single_import_per_statement":{"group_to_single_imports":false},"single_space_around_construct":{"constructs_followed_by_a_single_space":["abstract","as","case","catch","class","const_import","do","else","elseif","final","finally","for","foreach","function","function_import","if","insteadof","interface","namespace","new","private","protected","public","static","switch","trait","try","use","use_lambda","while"],"constructs_preceded_by_a_single_space":["as","else","elseif","use_lambda"]},"single_trait_insert_per_statement":true,"ternary_operator_spaces":true,"unary_operator_spaces":{"only_dec_inc":true},"blank_line_after_namespace":true,"constant_case":true,"control_structure_braces":true,"control_structure_continuation_position":true,"elseif":true,"function_declaration":{"closure_fn_spacing":"one"},"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"method_argument_space":{"after_heredoc":true},"no_break_comment":true,"no_closing_tag":true,"no_multiple_statements_per_line":true,"no_space_around_double_colon":true,"no_spaces_after_function_name":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_class_element_per_statement":{"elements":["property"]},"single_line_after_imports":true,"spaces_inside_parentheses":true,"statement_indentation":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"encoding":true,"full_opening_tag":true,"octal_notation":true,"clean_namespace":true,"no_unset_cast":true,"assign_null_coalescing_to_coalesce_equal":true,"normalize_index_brace":true,"heredoc_indentation":true,"no_whitespace_before_comma_in_array":{"after_heredoc":true},"trailing_comma_in_multiline":{"after_heredoc":true},"list_syntax":true,"ternary_to_null_coalescing":true,"array_syntax":true,"no_unused_imports":true,"fully_qualified_strict_types":true},"hashes":{"src\/Command\/Router.php":"bd622ffa950c6d25781736574b24ae95","src\/Command\/ServeCommand.php":"4c45cbcf7c8fe646c68c1ec35d9a4984","src\/Command\/RouterInterface.php":"857c4c498de00c34e01b83ab26b626c2","src\/Coverage\/Coverage.php":"12d615a63813d6364ddf2fcf1bca88b6","src\/Util\/ProjectRootResolver.php":"cfc86290611994f3efe9355e84ae4049","src\/Util\/Composer.php":"d96a080a50dc50b273faff5c4b889c76","src\/Util\/PhpUnitCommandExecutor.php":"84274486bc5836d4dfa6a15ae4711dcc","src\/PHPUnit\/PhpUnitHubExtension96.php":"3b63a14b3cd6c5f644711d92f8a78c06","src\/PHPUnit\/PhpUnitHubExtension.php":"93129f77f77b65589c24bb76fcfdb160","src\/PHPUnit\/PhpUnitHubExtension95.php":"2e86046ae8f8f3f779108244b25575b1","src\/Discoverer\/TestDiscoverer.php":"26db9dbb92284349b05b7320d1250a6f","src\/WebSocket\/StatusHandler.php":"e65bbba93f1f1c8bb116140370023aa1","src\/Http\/DecoratedHttpServer.php":"796efd5b1f3413200c4216eacd07baf4","src\/TestRunner\/TestRunner.php":"701b859454b17ca55737abfee36fed56","tests\/Command\/RouterTest.php":"64de0dd90223ca85ef11ab21d9e9f624","tests\/Command\/ServeCommandTest.php":"98e0865c6fd11eb3726bf182e37012e7","tests\/Coverage\/CoverageTest.php":"257a11ac383af627287be4e88eb7b487","tests\/Util\/ProjectRootResolverTest.php":"b77b8208c37629acedd90b4b675f761e","tests\/Util\/ComposerTest.php":"d9c61117c9f424c3bd45724c13a9ef87","tests\/Util\/PhpUnitCommandExecutorTest.php":"2f9d8ada0f682222427c4e5689e88d98","tests\/Discoverer\/TestDiscovererTest.php":"a4354743436349d6c8fdde06e9f3e969","tests\/WebSocket\/StatusHandlerTest.php":"532eaf4611becdc32d805efc6411f665","tests\/Http\/DecoratedHttpServerTest.php":"eca8426406a227d192f817bac2853cb2","tests\/TestRunner\/TestRunnerTest.php":"f9945b179ecc18a986fd81ad0a4278d8","src\/PHPUnit\/PhpUnitHubExtension9.php":"a5fbbecd4829ec624a5d615b1a9f5b17"}}
2 changes: 1 addition & 1 deletion .phpunit.result.cache

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
}
],
"require": {
"php": ">=8.2",
"php": ">=8.1",
"symfony/console": "^6.4|^7.3",
"symfony/process": "^6.4|^7.3",
"cboden/ratchet": "^0.4.4",
"react/event-loop": "^1.3",
"react/child-process": "^0.6.1",
"ramsey/uuid": "^4.7",
"phpunit/phpunit": "^10.6|^11.0|^12.0",
"phpunit/phpunit": "~9.5|^10.6|^11.0|^12.0",
"ext-simplexml": "*",
"ext-dom": "*"
},
Expand Down
5 changes: 4 additions & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@ parameters:
level: 6
paths:
- src
- tests
- tests
excludePaths:
- src/PHPUnit/PhpUnitHubExtension9.php
- src/PHPUnit/PhpUnitHubExtension.php
16 changes: 15 additions & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.6/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
>
Expand All @@ -14,6 +14,16 @@
</exclude>
</source>

<!-- <coverage>-->
<!-- <include>-->
<!-- <directory>src</directory>-->
<!-- </include>-->
<!-- <exclude>-->
<!-- <file>src/Command/ServeCommand.php</file>-->
<!-- <file>src/PHPUnit/PhpUnitHubExtension.php</file>-->
<!-- </exclude>-->
<!-- </coverage>-->

<testsuites>
<testsuite name="default">
<directory>tests</directory>
Expand All @@ -23,4 +33,8 @@
<extensions>
<bootstrap class="PhpUnitHub\PHPUnit\PhpUnitHubExtension"/>
</extensions>

<!-- <listeners>-->
<!-- <listener class="PhpUnitHub\PHPUnit\PhpUnitHubExtension9" />-->
<!-- </listeners>-->
</phpunit>
9 changes: 5 additions & 4 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ <h3 class="text-lg font-semibold text-white">Filters & Settings</h3>
</select>
</div>



<div class="form-group">
<label class="block text-sm font-medium text-gray-300 mb-2">Display Mode</label>
Expand All @@ -80,7 +80,7 @@ <h3 class="text-lg font-semibold text-white">Filters & Settings</h3>
</div>
</div>

<div class="form-group">
<div class="form-group" v-if="isPhpUnit10OrHigher">
<label class="block text-sm font-medium text-gray-300 mb-2">Output Options</label>
<div class="grid grid-cols-2 gap-2">
<label class="flex items-center text-sm">
Expand All @@ -103,7 +103,7 @@ <h3 class="text-lg font-semibold text-white">Filters & Settings</h3>
<input type="checkbox" v-model="store.state.options.displayIncomplete" class="mr-2">
Show Incomplete
</label>
<label class="flex items-center text-sm">
<label class="flex items-center text-sm" v-if="isPhpUnit11OrHigher">
<input type="checkbox" v-model="store.state.options.displayRisky" class="mr-2">
Show Risky
</label>
Expand Down Expand Up @@ -648,6 +648,7 @@ <h3 class="text-lg font-semibold text-white mb-2">{{ store.state.fileCoverage.pa
isAnyTestRunning: computedVals.isAnyTestRunning,
isAnyStopPending: computedVals.isAnyStopPending,
hasFailedTests: computedVals.hasFailedTests,
isPhpUnit10OrHigher: computedVals.isPhpUnit10OrHigher,

// Methods
toggleSuite: (suiteId) => app.store.toggleSuiteExpansion(suiteId),
Expand Down Expand Up @@ -682,4 +683,4 @@ <h3 class="text-lg font-semibold text-white mb-2">{{ store.state.fileCoverage.pa
}).mount('#app');
</script>
</body>
</html>
</html>
13 changes: 13 additions & 0 deletions public/js/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,19 @@ export class ApiClient {
this.baseUrl = baseUrl;
}

/**
* Fetch server info
*/
async fetchServerInfo() {
try {
const response = await fetch(`${this.baseUrl}/api/server-info`);
return await response.json();
} catch (error) {
console.error('Failed to fetch server info:', error);
throw error;
}
}

/**
* Fetch available tests
*/
Expand Down
71 changes: 31 additions & 40 deletions public/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ export class App {
*/
async initialize() {
try {
// Fetch server info
await this.fetchServerInfo();

// Fetch tests
await this.fetchTests();

Expand All @@ -40,6 +43,17 @@ export class App {
}
}

/**
* Fetch server info
*/
async fetchServerInfo() {
try {
this.store.state.serverInfo = await this.api.fetchServerInfo();
} catch (error) {
console.error('Failed to fetch server info:', error);
}
}

/**
* Fetch available tests
*/
Expand Down Expand Up @@ -257,6 +271,22 @@ export class App {
individualResults: computed(() => this.getIndividualResults()),
statusCounts: computed(() => this.getStatusCounts()),
filteredTestSuites: computed(() => this.getFilteredTestSuites()),
isPhpUnit10OrHigher: computed(() => {
const version = this.store.state.serverInfo?.phpunitVersion;
if (!version) {
return false;
}
const major = parseInt(version.split('.')[0], 10);
return major >= 10;
}),
isPhpUnit11OrHigher: computed(() => {
const version = this.store.state.serverInfo?.phpunitVersion;
if (!version) {
return false;
}
const major = parseInt(version.split('.')[0], 10);
return major >= 11;
}),
};
}

Expand Down Expand Up @@ -402,45 +432,6 @@ export class App {
};
}

/**
* Calculate summary statistics from test data
*/
calculateSummaryFromTests(suites) {
const summary = {
tests: 0,
assertions: 0,
time: 0,
failures: 0,
errors: 0,
warnings: 0,
skipped: 0,
deprecations: 0,
incomplete: 0,
risky: 0,
notices: 0,
};

suites.forEach(suite => {
suite.testcases.forEach(tc => {
summary.tests++;
summary.time += tc.duration || 0;
summary.assertions += tc.assertions || 0;

if (tc.status === 'failed') summary.failures++;
else if (tc.status === 'errored') summary.errors++;
else if (tc.status === 'skipped') summary.skipped++;
else if (tc.status === 'incomplete') summary.incomplete++;
else if (tc.status === 'risky') summary.risky++;

summary.warnings += tc.warnings?.length || 0;
summary.deprecations += tc.deprecations?.length || 0;
summary.notices += tc.notices?.length || 0;
});
});

return summary;
}

/**
* Get grouped results
*/
Expand Down Expand Up @@ -664,4 +655,4 @@ export class App {
console.error('Failed to fetch file coverage:', error);
}
}
}
}
18 changes: 18 additions & 0 deletions public/js/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ export class Store {

constructor() {
this.state = reactive({
// Server info
serverInfo: null,

// Test suites
testSuites: [],
availableSuites: [],
Expand Down Expand Up @@ -379,6 +382,21 @@ export class Store {
updateFavicon(run.summary.status === 'passed' ? 'success' : 'failure');
}

markRunAsComplete(runId) {
const run = this.state.realtimeTestRuns[runId];
if (run && !run.executionEnded) {
run.executionEnded = true;
run.status = 'finished';
this.state.lastCompletedRunId = runId;
delete this.state.runningTestIds[runId];
delete this.state.stopPending[runId];
this.state.isStarting = false;
this.updateSidebarAfterRun(runId);
// We don't have the final summary, so we can't accurately set the favicon here.
// It will be updated on the next run or when the summary eventually arrives.
}
}

/**
* Update sidebar test status
*/
Expand Down
1 change: 1 addition & 0 deletions public/js/tests/app.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class MockApiClient {
this.runTests = jest.fn(() => Promise.resolve({}));
this.stopAllTests = jest.fn(() => Promise.resolve());
this.stopSingleTest = jest.fn(() => Promise.resolve());
this.fetchServerInfo = jest.fn(() => Promise.resolve({}));
}
}

Expand Down
1 change: 1 addition & 0 deletions public/js/tests/store.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ describe('Store', () => {
testSuites: [],
coverageDriverMissing: false,
availableSuites: [],
serverInfo: null,
availableGroups: [],
isLoading: false,
isStarting: false,
Expand Down
1 change: 1 addition & 0 deletions public/js/tests/websocket.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class MockStore {
this.clearRunningTests = jest.fn();
this.getTestRun = jest.fn((runId) => this.state.realtimeTestRuns[runId]);
this.getRunningTestCount = jest.fn(() => Object.keys(this.state.runningTestIds || {}).length); // Corrected property and added safety
this.markRunAsComplete = jest.fn();
}
}

Expand Down
Loading
Loading