<commit_before><?php

namespace Exolnet\Envoy\Tests\Unit;

use Exolnet\Envoy\ConfigDeploy;
use Exolnet\Envoy\ConfigEnvironment;
use Exolnet\Envoy\Slack;
use InvalidArgumentException;
use Mockery as m;
use PHPUnit\Framework\TestCase;

class SlackTest extends TestCase
{
    /** @var \Exolnet\Envoy\Slack */
    protected $slack;

    public function setUp(): void
    {
        $this->slack = new Slack(
            'https://localhost/',
            'TheChannel',
            'TheTask',
            'TheProject',
            'TheEnv',
            'TheCommit',
            'TheRelease',
            'TheAppUrl',
            0
        );
    }

    /**
     * @test
     * @return void
     */
    public function testConstruct(): void
    {
        $this->assertInstanceOf(Slack::class, $this->slack);
    }

    /**
     * @test
     * @return void
     */
    public function testConstructHookIsNull(): void
    {
        $this->expectException(InvalidArgumentException::class);
        new Slack(null, '', '', '', '', '', '', '', 0);
    }

    /**
     * @test
     * @return void
     */
    public function testMake(): void
    {
        $environment = m::mock(ConfigEnvironment::class);
        $deploy = m::mock(ConfigDeploy::class);
        $task = '';

        $deploy->shouldReceive('get')->with('slack_url')->once()->andReturn('');
        $deploy->shouldReceive('get')->with('slack_channel')->once()->andReturn('');
        $deploy->shouldReceive('getName')->once()->andReturn('');
        $environment->shouldReceive('getName')->once()->andReturn('');
        $environment->shouldReceive('get')->with('commit')->once()->andReturn('');
        $environment->shouldReceive('get')->with('release')->once()->andReturn('');
        $environment->shouldReceive('get')->with('app_url')->once()->andReturn('');
        $deploy->shouldReceive('getTimeTotal')->once()->andReturn(1);

        $this->assertInstanceOf(Slack::class, Slack::make($environment, $deploy, $task));
    }

    /**
     * @test
     * @return void
     * @throws \GuzzleHttp\Exception\GuzzleException
     */
    public function testSend(): void
    {
        $this->slack->send();

        // Needed to assert something to have the coverage on the test
        $this->assertTrue(true);
    }
}
<commit_msg>Removed testSend since the post to localhost would not work in github actions. Coverage dropped to 69% lines.<commit_after><?php

namespace Exolnet\Envoy\Tests\Unit;

use Exolnet\Envoy\ConfigDeploy;
use Exolnet\Envoy\ConfigEnvironment;
use Exolnet\Envoy\Slack;
use InvalidArgumentException;
use Mockery as m;
use PHPUnit\Framework\TestCase;

class SlackTest extends TestCase
{
    /** @var \Exolnet\Envoy\Slack */
    protected $slack;

    public function setUp(): void
    {
        $this->slack = new Slack(
            'TheHook',
            'TheChannel',
            'TheTask',
            'TheProject',
            'TheEnv',
            'TheCommit',
            'TheRelease',
            'TheAppUrl',
            0
        );
    }

    /**
     * @test
     * @return void
     */
    public function testConstruct(): void
    {
        $this->assertInstanceOf(Slack::class, $this->slack);
    }

    /**
     * @test
     * @return void
     */
    public function testConstructHookIsNull(): void
    {
        $this->expectException(InvalidArgumentException::class);
        new Slack(null, '', '', '', '', '', '', '', 0);
    }

    /**
     * @test
     * @return void
     */
    public function testMake(): void
    {
        $environment = m::mock(ConfigEnvironment::class);
        $deploy = m::mock(ConfigDeploy::class);
        $task = '';

        $deploy->shouldReceive('get')->with('slack_url')->once()->andReturn('');
        $deploy->shouldReceive('get')->with('slack_channel')->once()->andReturn('');
        $deploy->shouldReceive('getName')->once()->andReturn('');
        $environment->shouldReceive('getName')->once()->andReturn('');
        $environment->shouldReceive('get')->with('commit')->once()->andReturn('');
        $environment->shouldReceive('get')->with('release')->once()->andReturn('');
        $environment->shouldReceive('get')->with('app_url')->once()->andReturn('');
        $deploy->shouldReceive('getTimeTotal')->once()->andReturn(1);

        $this->assertInstanceOf(Slack::class, Slack::make($environment, $deploy, $task));
    }
}

{'fraction_non_alphanumeric': 0.18010999083409715, 'fraction_numerical': 0.0018331805682859762, 'mean_word_length': 2.5985160758450125, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 74, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7626294', 'n_tokens_mistral': 1291, 'n_tokens_neox': 1243, 'n_words': 209}