A server that serves the page (the playground embedding an application on a partner's site, docs/embed.md) passes the fields of the partner's form and the visitor's provenance, and points the tickets at the partner's relay. Pure addition: a page without these keys behaves as before. Co-Authored-By: Claude Opus 5.5 <[email protected]>
25 lines
1 KiB
PHP
25 lines
1 KiB
PHP
<?php
|
|
|
|
namespace JumPHP\Tests\Kernel;
|
|
|
|
use JumPHP\Kernel\Engine;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
/** The first scene's params: project.yaml start_params, with what the page gives (JUMPHP_START_PARAMS, docs/embed.md) on top. */
|
|
final class StartParamsTest extends TestCase
|
|
{
|
|
public function testThePageParamsGoOverTheProjectOnes(): void
|
|
{
|
|
$merged = Engine::startParams(['mode' => 'solo', 'port' => 7000], '{"nickname":"ada","site":"example.com","port":7001}');
|
|
self::assertSame(['mode' => 'solo', 'port' => 7001, 'nickname' => 'ada', 'site' => 'example.com'], $merged);
|
|
}
|
|
|
|
public function testNothingOrSomethingElseThanAnObjectChangesNothing(): void
|
|
{
|
|
$configured = ['mode' => 'solo'];
|
|
foreach ([null, '', 'not json', '[1,2]', '"text"', '42', '{}'] as $json) {
|
|
self::assertSame($configured, Engine::startParams($configured, $json), var_export($json, true));
|
|
}
|
|
self::assertSame($configured, Engine::startParams($configured, ['nickname' => 'x']), 'only a JSON string is read');
|
|
}
|
|
}
|