Skip to content

Commit

Permalink
Test manifest.xml validity
Browse files Browse the repository at this point in the history
  • Loading branch information
villfa committed Feb 4, 2022
1 parent 54dd3b7 commit 0fb0453
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ build: box
$(COMPOSER_BIN) config platform.php 7.1.3 --working-dir=build/
$(COMPOSER_BIN) update --no-dev --no-interaction --prefer-dist --working-dir=build/
CHURN_VERSION=$$( $(PHP_BIN) build/bin/churn --version --no-ansi | grep -Po '(?<= )[^@]+' ) ;\
sed -i -e "s@dev-master@$${CHURN_VERSION}@g" build/manifest.xml
sed -i -e "s@0.0.0-dev@$${CHURN_VERSION}@g" build/manifest.xml
$(PHP_BIN) build/box.phar validate build/box.json.dist
$(PHP_BIN) build/box.phar compile --working-dir=build/

Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"require-dev": {
"bamarni/composer-bin-plugin": "^1.4",
"mockery/mockery": "^1.2.0",
"phar-io/manifest": "^1.0 || ^2.0",
"symfony/phpunit-bridge": "^5.1 || ^6.0"
},
"autoload": {
Expand Down
2 changes: 1 addition & 1 deletion manifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<phar xmlns="https://phar.io/xml/manifest/1.0">
<contains name="bmitch/churn-php" version="dev-master" type="application" />
<contains name="bmitch/churn-php" version="0.0.0-dev" type="application" />
<copyright>
<author name="Bill Mitchell" email="wkmitch@gmail.com"/>
<license type="MIT" url="https://github.com/bmitch/churn-php/blob/master/LICENSE.md"/>
Expand Down
24 changes: 24 additions & 0 deletions tests/Integration/ManifestTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

declare(strict_types=1);

namespace Churn\Tests\Integration;

use Churn\Tests\BaseTestCase;
use PharIo\Manifest\ManifestLoader;

class ManifestTest extends BaseTestCase
{
/** @test */
public function manifest_is_valid()
{
$path = __DIR__ . '/../../manifest.xml';
$this->assertTrue(is_file($path), 'manifest.xml not found');

$manifest = ManifestLoader::fromFile($path);

$name = method_exists($manifest->getName(), 'asString') ? $manifest->getName()->asString() : (string) $manifest->getName();
$this->assertEquals('bmitch/churn-php', $name);
$this->assertGreaterThan(0, $manifest->getRequirements()->count());
}
}

0 comments on commit 0fb0453

Please sign in to comment.