1<?php 2 3class infoutils_getversiondata_test extends DokuWikiTest { 4 5 /** 6 * On a git checkout the reported date and hash must be well-formed. 7 * 8 * The git call uses --pretty=reference to avoid percent placeholders: on 9 * Windows escapeshellarg() replaces them with spaces, so the old 10 * "--pretty=format:%h %cd" command made git echo literal text and 11 * getVersionData() reported date "h" with an empty hash. This test runs on 12 * the Windows CI too, where that old behaviour would fail these assertions. 13 */ 14 function test_gitVersionIsWellFormed() { 15 $version = getVersionData(); 16 if ($version['type'] !== 'Git') { 17 $this->markTestSkipped('not running from a git checkout'); 18 } 19 20 $this->assertMatchesRegularExpression('/^\d{4}-\d{2}-\d{2}$/', $version['date']); 21 $this->assertMatchesRegularExpression('/^[0-9a-f]{7,40}$/', $version['sha']); 22 } 23} 24