Commit 638d76ca authored by michael's avatar michael

60: Add library config files for testing, replace default library with test...

60: Add library config files for testing, replace default library with test library in publish test. Change publish test to use test book
parent 5d244a86
......@@ -2,6 +2,7 @@
namespace AppBundle\Tests\Controller;
use AppBundle\Model\Library;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Bundle\SwiftmailerBundle\DataCollector\MessageDataCollector;
use Symfony\Component\HttpFoundation\Response;
......@@ -15,10 +16,13 @@ class PublishControllerTest extends WebTestCase {
$client = static::createClient();
$client->enableProfiler();
$hookBody = $this->getGithubRequestBody();
$hookBody = $this->getTestBookRequestBody();
$headers = $this->getHeaders();
$endpoint = '/admin/listen';
$testLibrary = new Library(__DIR__ . '/../Files/books');
$client->getContainer()->set('library', $testLibrary);
$client->request('POST', $endpoint, [], [], $headers, $hookBody);
$statusCode = $client->getResponse()->getStatusCode();
......@@ -41,8 +45,8 @@ class PublishControllerTest extends WebTestCase {
/**
* @return string
*/
private function getGithubRequestBody(): string {
return file_get_contents(__DIR__ . '/../Files/webhook-github-push-sample.json');
private function getTestBookRequestBody(): string {
return file_get_contents(__DIR__ . '/../Files/webhook-gitlab-push-test-book.json');
}
/**
......@@ -50,7 +54,7 @@ class PublishControllerTest extends WebTestCase {
*/
private function getHeaders(): array {
$headers = [
'HTTP_X-GitHub-Event' => 'push', // prefix required for non-standard
'HTTP_X-GitLab-Event' => 'Push Hook', // prefix required for non-standard
'Content-Type' => 'application/json'
];
......
name: TestBook
description: Real repo, but used for testing publishing
langs:
en:
repo: 'https://lab.civicrm.org/seanmadsen/docs-test-book'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment