✨feature: Add projects homepage and support for adding new projects
This commit is contained in:
@@ -25,7 +25,6 @@ final class BoardApiTest extends IntegrationTestCase
|
||||
public function testBoardStateEndpointReturnsProjectState(): void
|
||||
{
|
||||
$projectId = $this->createProject();
|
||||
|
||||
$response = $this->callApi(
|
||||
'public/api/board-state.php',
|
||||
'GET',
|
||||
@@ -37,6 +36,36 @@ final class BoardApiTest extends IntegrationTestCase
|
||||
self::assertContains('trash', array_column($response['payload']['columns'], 'id'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure create-project creates markdown storage and returns the new project state.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testCreateProjectEndpointCreatesProject(): void
|
||||
{
|
||||
$token = csrf_token();
|
||||
|
||||
$response = $this->callApi(
|
||||
'public/api/create-project.php',
|
||||
'POST',
|
||||
[],
|
||||
[
|
||||
'title' => 'Release Planning',
|
||||
'slug' => 'release-planning',
|
||||
'body' => 'Track launch work.',
|
||||
'_token' => $token,
|
||||
],
|
||||
['HTTP_X_CSRF_TOKEN' => $token]
|
||||
);
|
||||
|
||||
self::assertSame(200, $response['status']);
|
||||
self::assertTrue($response['payload']['success']);
|
||||
self::assertSame('release-planning', $response['payload']['state']['project']['id']);
|
||||
self::assertSame('/?project=release-planning', $response['payload']['state']['projectUrl']);
|
||||
self::assertContains('trash', array_column($response['payload']['state']['columns'], 'id'));
|
||||
self::assertFileExists($this->projectRoot . DIRECTORY_SEPARATOR . 'release-planning' . DIRECTORY_SEPARATOR . 'index.md');
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure state-changing endpoints reject missing CSRF tokens.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user