<?php



namespace Liip\RMT\Tests\Functional;

class FilesUpdateTest extends RMTFunctionalTestBase
{
    public function testTwoUpdate(): void
    {
        $ymlBefore = <<<YML
my-project:
   version: 1
YML;
        $iniBefore = <<<INI
stable-version: 1
dynamic-version: 1
INI;
        $ymlAfter = <<<YML
my-project:
   version: 2
YML;
        $iniAfter = <<<INI
stable-version: 1
dynamic-version: 2
INI;
        $this->createChangelog('simple');
        $this->createConfig('simple', 'changelog', ['pre-release-actions' => [
            'files-update' => [
                ['config.yml'],
                ['app.ini', "dynamic-version: %version%"]
        ]]]);

        file_put_contents('config.yml', $ymlBefore);
        file_put_contents('app.ini', $iniBefore);
//        $this->manualDebug();
        exec('./RMT release --comment=Test -n', $output);
        self::assertEquals($ymlAfter, file_get_contents('config.yml'));
        self::assertEquals($iniAfter, file_get_contents('app.ini'));
    }

}
