<commit_before><?php
	declare(strict_types = 1);

	namespace Edde\Common\Web;

	use Edde\Api\Database\IDriver;
	use Edde\Api\File\ITempDirectory;
	use Edde\Api\Schema\ISchemaFactory;
	use Edde\Api\Schema\ISchemaManager;
	use Edde\Api\Storage\IStorage;
	use Edde\Api\Upgrade\IUpgradeManager;
	use Edde\Common\Asset\AssetStorage;
	use Edde\Common\Asset\StorageDirectory;
	use Edde\Common\Cache\CacheDirectory;
	use Edde\Common\Cache\CacheFactory;
	use Edde\Common\Database\DatabaseStorage;
	use Edde\Common\File\File;
	use Edde\Common\File\FileUtils;
	use Edde\Common\File\RootDirectory;
	use Edde\Common\File\TempDirectory;
	use Edde\Common\Resource\ResourceList;
	use Edde\Common\Schema\SchemaFactory;
	use Edde\Common\Schema\SchemaManager;
	use Edde\Common\Strings\StringUtils;
	use Edde\Common\Upgrade\UpgradeManager;
	use Edde\Common\Url\Url;
	use Edde\Ext\Cache\FileCacheStorage;
	use Edde\Ext\Container\ContainerFactory;
	use Edde\Ext\Database\Sqlite\SqliteDriver;
	use Edde\Ext\Upgrade\InitialStorageUpgrade;
	use phpunit\framework\TestCase;

	class StyleSheetCompilerTest extends TestCase {
		/**
		 * @var ITempDirectory
		 */
		protected $tempDirectory;
		/**
		 * @var IStorage
		 */
		protected $storage;
		/**
		 * @var ISchemaManager
		 */
		protected $schemaManager;
		/**
		 * @var IUpgradeManager
		 */
		protected $upgradeManager;
		/**
		 * @var SqliteDriver
		 */
		protected $sqliteDriver;

		public function setUp() {
			FileUtils::recreate(__DIR__ . '/public');
			$this->tempDirectory = new TempDirectory(__DIR__ . '/temp');
			$this->tempDirectory->purge();

			$container = ContainerFactory::create([
				IStorage::class => DatabaseStorage::class,
				ISchemaFactory::class => SchemaFactory::class,
				ISchemaManager::class => SchemaManager::class,
				IUpgradeManager::class => UpgradeManager::class,
				IDriver::class => function () {
					return $this->sqliteDriver = new SqliteDriver('sqlite:' . $this->getDatabaseFileName());
				},
			]);
			$this->storage = $container->create(IStorage::class);
			$this->schemaManager = $container->create(ISchemaManager::class);
			$this->upgradeManager = $container->create(IUpgradeManager::class);

			$this->upgradeManager->registerUpgrade($upgrade = new InitialStorageUpgrade());
			$container->inject($upgrade);
			$this->upgradeManager->upgrade();
		}

		protected function getDatabaseFileName() {
			return $this->tempDirectory->filename('resource-test-' . sha1(microtime() . random_int(0, 99999)) . '.sqlite');
		}

		public function testCommon() {
			$styleSheetCompiler = new StyleSheetCompiler();
			$styleSheetCompiler->lazyFileStorage($fileStorage = new AssetStorage(new RootDirectory(__DIR__), new StorageDirectory(__DIR__ . '/public')));
			$styleSheetCompiler->lazyTempDirectory($this->tempDirectory);
			$styleSheetCompiler->lazyCacheFactory(new CacheFactory(__DIR__, new FileCacheStorage(new CacheDirectory(__DIR__ . '/temp'))));
			$styleSheetCompiler->cache();
			$resourceList = new ResourceList();
			$resourceList->addResource(new File(__DIR__ . '/assets/css/font-awesome.css'));<commit_msg>- fixed stupid bug<commit_after><?php
	declare(strict_types = 1);

	namespace Edde\Common\Web;

	use Edde\Api\Database\IDriver;
	use Edde\Api\File\ITempDirectory;
	use Edde\Api\Schema\ISchemaFactory;
	use Edde\Api\Schema\ISchemaManager;
	use Edde\Api\Storage\IStorage;
	use Edde\Api\Upgrade\IUpgradeManager;
	use Edde\Common\Asset\AssetStorage;
	use Edde\Common\Asset\StorageDirectory;
	use Edde\Common\Cache\CacheDirectory;
	use Edde\Common\Cache\CacheFactory;
	use Edde\Common\Database\DatabaseStorage;
	use Edde\Common\File\File;
	use Edde\Common\File\FileUtils;
	use Edde\Common\File\RootDirectory;
	use Edde\Common\File\TempDirectory;
	use Edde\Common\Resource\ResourceList;
	use Edde\Common\Schema\SchemaFactory;
	use Edde\Common\Schema\SchemaManager;
	use Edde\Common\Strings\StringUtils;
	use Edde\Common\Upgrade\UpgradeManager;
	use Edde\Common\Url\Url;
	use Edde\Ext\Cache\FileCacheStorage;
	use Edde\Ext\Container\ContainerFactory;
	use Edde\Ext\Database\Sqlite\SqliteDriver;
	use Edde\Ext\Upgrade\InitialStorageUpgrade;
	use phpunit\framework\TestCase;

	class StyleSheetCompilerTest extends TestCase {
		/**
		 * @var ITempDirectory
		 */
		protected $tempDirectory;
		/**
		 * @var IStorage
		 */
		protected $storage;
		/**
		 * @var ISchemaManager
		 */
		protected $schemaManager;
		/**
		 * @var IUpgradeManager
		 */
		protected $upgradeManager;
		/**
		 * @var SqliteDriver
		 */
		protected $sqliteDriver;

		public function setUp() {
			FileUtils::recreate(__DIR__ . '/public');
			$this->tempDirectory = new TempDirectory(__DIR__ . '/temp');
			$this->tempDirectory->purge();

			$container = ContainerFactory::create([
				IStorage::class => DatabaseStorage::class,
				ISchemaFactory::class => SchemaFactory::class,
				ISchemaManager::class => SchemaManager::class,
				IUpgradeManager::class => UpgradeManager::class,
				IDriver::class => function () {
					return $this->sqliteDriver = new SqliteDriver('sqlite:' . $this->getDatabaseFileName());
				},
			]);
			$this->storage = $container->create(IStorage::class);
			$this->schemaManager = $container->create(ISchemaManager::class);
			$this->upgradeManager = $container->create(IUpgradeManager::class);

			$this->upgradeManager->registerUpgrade($upgrade = new InitialStorageUpgrade());
			$container->inject($upgrade);
			$this->upgradeManager->upgrade();
		}

		protected function getDatabaseFileName() {
			return $this->tempDirectory->filename('resource-test-' . sha1(microtime() . random_int(0, 99999)) . '.sqlite');
		}

		public function testCommon() {
			$styleSheetCompiler = new StyleSheetCompiler();
			$styleSheetCompiler->lazyAssetStorage($assetStorage = new AssetStorage(new RootDirectory(__DIR__), new StorageDirectory(__DIR__ . '/public')));
			$styleSheetCompiler->lazyTempDirectory($this->tempDirectory);
			$styleSheetCompiler->lazyCacheFactory(new CacheFactory(__DIR__, new FileCacheStorage(new CacheDirectory(__DIR__ . '/temp'))));
			$styleSheetCompiler->cache();
			$resourceList = new ResourceList();
			$resourceList->addResource(new File(__DIR__ . '/assets/css/font-awesome.css'));
{'fraction_non_alphanumeric': 0.13883039040984935, 'fraction_numerical': 0.0025919326097521463, 'mean_word_length': 4.88560533841754, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 61, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4436357', 'n_tokens_mistral': 2126, 'n_tokens_neox': 1898, 'n_words': 312}