<commit_before><?php

namespace Stitcher;

use Pageon\Html\Image\FixedWidthScaler;
use Pageon\Html\Image\ImageFactory;
use Stitcher\Application\DevelopmentServer;
use Stitcher\Command\Parse;
use Stitcher\Command\PartialParse;
use Stitcher\Page\Adapter\AdapterFactory;
use Stitcher\Page\PageFactory;
use Stitcher\Page\PageParser;
use Stitcher\Page\PageRenderer;
use Stitcher\Renderer\Renderer;
use Stitcher\Renderer\RendererFactory;
use Stitcher\Test\CreateStitcherFiles;
use Stitcher\Test\StitcherTest;
use Stitcher\Variable\VariableFactory;
use Stitcher\Variable\VariableParser;

class AppTest extends StitcherTest
{
    use CreateStitcherFiles;

    /** @test */
    public function test_init()
    {
        App::init(__DIR__ . '/../resources');

        $servicesToTest = [
            VariableFactory::class,
            VariableParser::class,
            FixedWidthScaler::class,
            ImageFactory::class,
            AdapterFactory::class,
            PageFactory::class,
            RendererFactory::class,
            PageParser::class,
            PageRenderer::class,
            Parse::class,
            PartialParse::class,
            DevelopmentServer::class
        ];

        foreach ($servicesToTest as $class) {
            $this->assertServiceRegistered($class);
        }

        $this->assertInstanceOf(Renderer::class, App::get('renderer'));
    }

    private function assertServiceRegistered(string $class)
    {
        $this->assertInstanceOf($class, App::get($class));
    }
}<commit_msg>Add tests for App helper methods<commit_after><?php

namespace Stitcher;

use Pageon\Html\Image\FixedWidthScaler;
use Pageon\Html\Image\ImageFactory;
use Stitcher\Application\DevelopmentServer;
use Stitcher\Application\ProductionServer;
use Stitcher\Command\Parse;
use Stitcher\Command\PartialParse;
use Stitcher\Page\Adapter\AdapterFactory;
use Stitcher\Page\PageFactory;
use Stitcher\Page\PageParser;
use Stitcher\Page\PageRenderer;
use Stitcher\Renderer\Renderer;
use Stitcher\Renderer\RendererFactory;
use Stitcher\Test\CreateStitcherFiles;
use Stitcher\Test\StitcherTest;
use Stitcher\Variable\VariableFactory;
use Stitcher\Variable\VariableParser;

class AppTest extends StitcherTest
{
    use CreateStitcherFiles;

    /** @test */
    public function test_init()
    {
        App::init(__DIR__ . '/../resources');

        $servicesToTest = [
            VariableFactory::class,
            VariableParser::class,
            FixedWidthScaler::class,
            ImageFactory::class,
            AdapterFactory::class,
            PageFactory::class,
            RendererFactory::class,
            PageParser::class,
            PageRenderer::class,
            Parse::class,
            PartialParse::class,
            DevelopmentServer::class
        ];

        foreach ($servicesToTest as $class) {
            $this->assertServiceRegistered($class);
        }

        $this->assertInstanceOf(Renderer::class, App::get('renderer'));
    }

    /** @test */
    public function it_can_get_the_development_server()
    {
        App::init();

        $this->assertInstanceOf(DevelopmentServer::class, App::developmentServer());
    }

    /** @test */
    public function it_can_get_the_production_server()
    {
        App::init();

        $this->assertInstanceOf(ProductionServer::class, App::productionServer());
    }

    private function assertServiceRegistered(string $class)
    {
        $this->assertInstanceOf($class, App::get($class));
    }
}
{'fraction_non_alphanumeric': 0.11123820417500715, 'fraction_numerical': 0.0, 'mean_word_length': 3.048611111111111, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7457026', 'n_tokens_mistral': 1008, 'n_tokens_neox': 973, 'n_words': 163}