Drupal investigation

testAPIDocs.php 1.3KB

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace Consolidation\OutputFormatters;
  3. use Consolidation\OutputFormatters\Options\FormatterOptions;
  4. use Symfony\Component\Console\Input\StringInput;
  5. use Symfony\Component\Console\Input\InputOption;
  6. use Symfony\Component\Console\Input\InputArgument;
  7. use Symfony\Component\Console\Input\InputDefinition;
  8. class APIDocsTests extends \PHPUnit_Framework_TestCase
  9. {
  10. function testAPIDocs()
  11. {
  12. if (getenv('CI')) {
  13. $this->markTestIncomplete(
  14. 'API generation has slight variations when run on CI server. This test is therefore skipped on CI until we can make the test results consistent.'
  15. );
  16. }
  17. $testDocs = tempnam(sys_get_temp_dir(), 'TestAPIDocs.md');
  18. $currentDocs = getcwd() . '/docs/api.md';
  19. passthru("vendor/bin/phpdoc-md generate src > $testDocs");
  20. $testDocsContent = file_get_contents($testDocs);
  21. $currentDocsContent = file_get_contents($currentDocs);
  22. $testDocsContent = str_replace (array("\r\n", "\r"), "\n", $testDocsContent);
  23. $currentDocsContent = str_replace (array("\r\n", "\r"), "\n", $currentDocsContent);
  24. $this->assertEquals($testDocsContent, $currentDocsContent, "API docuementation out of date. Run 'composer api' to update.");
  25. }
  26. }