Skip to content

Commit cd46e08

Browse files
committed
Add module structure
Signed-off-by: Anton Fedurtsya <[email protected]>
1 parent 0383940 commit cd46e08

28 files changed

+552
-2
lines changed

.editorconfig

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# EditorConfig is awesome: https://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
# Unix-style newlines with a newline ending every file
7+
[*]
8+
end_of_line = lf
9+
insert_final_newline = true
10+
charset = utf-8
11+
indent_style = space
12+
indent_size = 4
13+
trim_trailing_whitespace = true
14+
15+
# Unix-style newlines with a newline ending every file
16+
[{*.yml,*.yaml,*.json}]
17+
indent_size = 2

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/composer.lock
2+
/Coverage
3+
/source
4+
/var
5+
/vendor

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Change Log for Fresh-Advance Sitemap module.
2+
3+
All notable changes to this project will be documented in this file.
4+
The format is based on [Keep a Changelog](http://keepachangelog.com/)
5+
and this project adheres to [Semantic Versioning](http://semver.org/).
6+
7+
## [v1.0.0] - Unreleased
8+
9+
[v1.0.0]: https://github.com/Fresh-Advance/Sitemap/compare/03839403...v1.0.0

LICENSE

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Fresh Advance OXID Sitemap module End-User License Agreement
2+
3+
The module is not free to use on production environment, but is free for:
4+
* Trying out on development environment
5+
* Non-profit organizations
6+
7+
No parts of the module can be copied without written permission from the original module owner (MB Arbatos Klubas).
8+
9+
The official pricing options will come later, for now usage on production is possible on
10+
written permission from [email protected]
11+
12+
License fee will show interest in a module and as a result allow us to improve, fix bugs
13+
and ensure module is upgraded to fit the newest versions of the shop.

README.md

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,35 @@
1-
# Sitemap
2-
OXID Sitemap module.
1+
# Sitemap module for OXID eShop
2+
3+
[![Development](https://github.com/Fresh-Advance/Sitemap/actions/workflows/development.yml/badge.svg?branch=b-7.0.x)](https://github.com/Fresh-Advance/Sitemap/actions/workflows/development.yml)
4+
[![Latest Version](https://img.shields.io/packagist/v/Fresh-Advance/Sitemap?logo=composer&label=latest&include_prereleases&color=orange)](https://packagist.org/packages/Fresh-Advance/Sitemap)
5+
[![PHP Version](https://img.shields.io/packagist/php-v/Fresh-Advance/Sitemap)](https://github.com/Fresh-Advance/Sitemap)
6+
7+
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=Fresh-Advance_Sitemap&metric=alert_status)](https://sonarcloud.io/dashboard?id=Fresh-Advance_Sitemap)
8+
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=Fresh-Advance_Sitemap&metric=coverage)](https://sonarcloud.io/dashboard?id=Fresh-Advance_Sitemap)
9+
[![Technical Debt](https://sonarcloud.io/api/project_badges/measure?project=Fresh-Advance_Sitemap&metric=sqale_index)](https://sonarcloud.io/dashboard?id=Fresh-Advance_Sitemap)
10+
11+
**In development!, do not use yet**
12+
13+
## Features
14+
15+
* Not yet :)
16+
17+
## Compatibility
18+
19+
* Branch b-7.0.x is compatible with OXID Shop compilation 7.0.0-rc.2 and up
20+
21+
## What to expect in next versions
22+
23+
* Sitemap functionality
24+
25+
## Installation
26+
27+
Module is available on packagist and installable via composer
28+
29+
```
30+
composer require fresh-advance/sitemap
31+
```
32+
33+
## License
34+
35+
Please make sure you checked the License before using the module.

composer.json

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{
2+
"name": "fresh-advance/sitemap",
3+
"description": "OXID 7 Sitemap Module",
4+
"license": "proprietary",
5+
"type": "oxideshop-module",
6+
"keywords": [
7+
"oxid",
8+
"modules",
9+
"sitemap"
10+
],
11+
"minimum-stability": "dev",
12+
"prefer-stable": true,
13+
"prefer-dist": true,
14+
"require": {
15+
"php": "^8.0",
16+
"oxid-esales/oxideshop-ce": "*"
17+
},
18+
"conflict": {
19+
"oxid-esales/oxideshop-ce": "<7.0.0-rc.2"
20+
},
21+
"require-dev": {
22+
"phpunit/phpunit": "^9.5",
23+
"phpstan/phpstan": "^1.8.10",
24+
"squizlabs/php_codesniffer": "3.*",
25+
"phpmd/phpmd": "^2.11"
26+
},
27+
"autoload": {
28+
"psr-4": {
29+
"FreshAdvance\\Sitemap\\": "./src",
30+
"FreshAdvance\\Sitemap\\Tests\\": "./tests"
31+
}
32+
},
33+
"scripts": {
34+
"phpcs": "phpcs --standard=tests/phpcs.xml",
35+
"phpcbf": "phpcbf --standard=tests/phpcs.xml",
36+
"phpstan": "phpstan -ctests/PhpStan/phpstan.neon analyse src/",
37+
"phpstan-report": "phpstan -ctests/PhpStan/phpstan.neon analyse src/ --error-format=json > phpstan.report.json",
38+
"phpmd": "phpmd src text cleancode,codesize,design,naming,unusedcode",
39+
"phpmd-report": "phpmd src json cleancode,codesize,design,naming,unusedcode --reportfile phpmd.report.json",
40+
"static": [
41+
"@phpcs",
42+
"@phpstan",
43+
"@phpmd"
44+
],
45+
"phpunit": "XDEBUG_MODE=coverage vendor/bin/phpunit --bootstrap=/var/www/source/bootstrap.php --config=tests/",
46+
"phpunit-coverage": "XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-text --bootstrap=/var/www/source/bootstrap.php --config=tests/ --coverage-html=tests/result/coverage",
47+
"phpunit-clover": "XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-text --coverage-clover=tests/result/coverage.xml --log-junit=tests/result/junit-log.xml --bootstrap=/var/www/source/bootstrap.php --config=tests/",
48+
"codeception": "cd /var/www/; MODULE_IDS=fa_sitemap /var/www/vendor/bin/codecept run acceptance -c /var/www/vendor/fresh-advance/sitemap/tests/codeception.yml -g fa_sitemap; cd -"
49+
},
50+
"config": {
51+
"allow-plugins": {
52+
"oxid-esales/oxideshop-composer-plugin": true,
53+
"oxid-esales/oxideshop-unified-namespace-generator": true
54+
}
55+
}
56+
}

metadata.php

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
/**
4+
* Copyright © MB Arbatos Klubas. All rights reserved.
5+
* See LICENSE file for license details.
6+
*/
7+
8+
declare(strict_types=1);
9+
10+
/**
11+
* Metadata version
12+
*/
13+
$sMetadataVersion = '2.1';
14+
15+
/**
16+
* Module information
17+
*/
18+
$aModule = [
19+
'id' => \FreshAdvance\Sitemap\Module::MODULE_ID,
20+
'title' => 'Invoice',
21+
'description' => [
22+
'en' => 'Sitemap module for OXID eShop.',
23+
],
24+
'version' => '1.0.0',
25+
'author' => 'Anton Fedurtsya',
26+
'email' => '[email protected]',
27+
'url' => '',
28+
'controllers' => [
29+
],
30+
'extend' => [
31+
],
32+
'settings' => [
33+
34+
],
35+
'events' => [
36+
'onActivate' => '\FreshAdvance\Sitemap\Events::onActivate',
37+
'onDeactivate' => '\FreshAdvance\Sitemap\Events::onDeactivate'
38+
]
39+
];

services.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
services:
2+
_defaults:
3+
public: false
4+
autowire: true
5+
6+
FreshAdvance\Sitemap\Core\Registry:
7+
class: OxidEsales\Eshop\Core\Registry
8+
public: true

src/Module.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
/**
4+
* Copyright © MB Arbatos Klubas. All rights reserved.
5+
* See LICENSE file for license details.
6+
*/
7+
8+
declare(strict_types=1);
9+
10+
namespace FreshAdvance\Sitemap;
11+
12+
class Module
13+
{
14+
public const MODULE_ID = 'fa_sitemap';
15+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
/**
4+
* Copyright © MB Arbatos Klubas. All rights reserved.
5+
* See LICENSE file for license details.
6+
*/
7+
8+
declare(strict_types=1);
9+
10+
// This is acceptance bootstrap
11+
use Symfony\Component\Filesystem\Path;
12+
13+
//require_once Path::join((new \OxidEsales\Facts\Facts())->getShopRootPath(), 'source', 'bootstrap.php');
14+
require_once '/var/www/source/bootstrap.php';
15+
16+
$helper = new \OxidEsales\Codeception\Module\FixturesHelper();
17+
$helper->loadRuntimeFixtures(__DIR__ . '/../_data/fixtures.php');

tests/Codeception/Config/params.php

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
<?php
2+
3+
/**
4+
* Copyright © MB Arbatos Klubas. All rights reserved.
5+
* See LICENSE file for license details.
6+
*/
7+
8+
declare(strict_types=1);
9+
10+
use OxidEsales\Facts\Config\ConfigFile;
11+
use OxidEsales\Facts\Facts;
12+
use OxidEsales\Codeception\Module\Database\DatabaseDefaultsFileGenerator;
13+
use Symfony\Component\Filesystem\Path;
14+
15+
$facts = new Facts();
16+
return [
17+
'SHOP_URL' => $facts->getShopUrl(),
18+
'SHOP_SOURCE_PATH' => $facts->getSourcePath(),
19+
'VENDOR_PATH' => $facts->getVendorPath(),
20+
'DB_NAME' => $facts->getDatabaseName(),
21+
'DB_USERNAME' => $facts->getDatabaseUserName(),
22+
'DB_PASSWORD' => $facts->getDatabasePassword(),
23+
'DB_HOST' => $facts->getDatabaseHost(),
24+
'DB_PORT' => $facts->getDatabasePort(),
25+
'DUMP_PATH' => getTestDataDumpFilePath(),
26+
'MODULE_DUMP_PATH' => getModuleTestDataDumpFilePath(),
27+
'FIXTURES_PATH' => getTestFixtureSqlFilePath(),
28+
'MYSQL_CONFIG_PATH' => getMysqlConfigPath(),
29+
'SELENIUM_SERVER_PORT' => getenv('SELENIUM_SERVER_PORT') ?: '4444',
30+
'SELENIUM_SERVER_HOST' => getenv('SELENIUM_SERVER_HOST') ?: 'selenium',
31+
'BROWSER_NAME' => getenv('BROWSER_NAME') ?: 'chrome',
32+
'PHP_BIN' => getenv('PHPBIN') ?: 'php',
33+
'SCREEN_SHOT_URL' => getenv('CC_SCREEN_SHOTS_PATH') ?: '',
34+
];
35+
36+
function getTestDataDumpFilePath(): string
37+
{
38+
return Path::join(__DIR__, '/../', '_data', 'generated', 'dump.sql');
39+
}
40+
41+
function getModuleTestDataDumpFilePath()
42+
{
43+
return Path::join(__DIR__, '/../', '_data', 'dump.sql');
44+
}
45+
46+
function getTestFixtureSqlFilePath(): string
47+
{
48+
$facts = new Facts();
49+
50+
return Path::join(__DIR__, '/../../', 'fixtures', 'testdata_' . strtolower($facts->getEdition()) . '.sql');
51+
}
52+
53+
function getShopSuitePath($facts)
54+
{
55+
$testSuitePath = getenv('TEST_SUITE');
56+
57+
if (!$testSuitePath) {
58+
$testSuitePath = $facts->getShopRootPath() . '/tests';
59+
}
60+
61+
return $testSuitePath;
62+
}
63+
64+
function getShopTestPath()
65+
{
66+
$facts = new Facts();
67+
68+
if ($facts->isEnterprise()) {
69+
$shopTestPath = $facts->getEnterpriseEditionRootPath() . '/Tests';
70+
} else {
71+
$shopTestPath = getShopSuitePath($facts);
72+
}
73+
74+
return $shopTestPath;
75+
}
76+
77+
function getMysqlConfigPath()
78+
{
79+
$facts = new Facts();
80+
$configFilePath = Path::join($facts->getSourcePath(), 'config.inc.php');
81+
$configFile = new ConfigFile($configFilePath);
82+
$generator = new DatabaseDefaultsFileGenerator($configFile);
83+
84+
return $generator->generate();
85+
}

tests/Codeception/_data/dump.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#Add default admin user
2+
REPLACE INTO `oxuser` (`OXID`, `OXACTIVE`, `OXRIGHTS`, `OXSHOPID`, `OXUSERNAME`, `OXPASSWORD`, `OXPASSSALT`, `OXCREATE`, `OXREGISTER`, `OXTIMESTAMP`, `OXBIRTHDATE`) VALUES
3+
('oxdefaultadmin',1,'malladmin',1,'[email protected]','6cb4a34e1b66d3445108cd91b67f98b9','6631386565336161636139613634663766383538633566623662613036636539', '2003-01-01 00:00:00', '2003-01-01 00:00:00', '2003-01-01 00:00:00', '1985-01-01');

tests/Codeception/_data/fixtures.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
/**
4+
* Copyright © MB Arbatos Klubas. All rights reserved.
5+
* See LICENSE file for license details.
6+
*/
7+
8+
declare(strict_types=1);
9+
10+
return [
11+
'admin' => [
12+
'OXID' => 'oxdefaultadmin',
13+
'email' => '[email protected]',
14+
'password' => 'admin0303',
15+
],
16+
];

tests/Codeception/_output/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*
2+
!.gitignore
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
3+
/**
4+
* Copyright © MB Arbatos Klubas. All rights reserved.
5+
* See LICENSE file for license details.
6+
*/
7+
8+
declare(strict_types=1);
9+
10+
namespace FreshAdvance\Sitemap\Tests\Codeception;
11+
12+
use Codeception\Util\Fixtures;
13+
use OxidEsales\Codeception\Admin\AdminLoginPage;
14+
use OxidEsales\Codeception\Admin\AdminPanel;
15+
use OxidEsales\Codeception\Page\Home;
16+
use FreshAdvance\Sitemap\Tests\Codeception\_generated\AcceptanceTesterActions;
17+
18+
final class AcceptanceTester extends \Codeception\Actor
19+
{
20+
use AcceptanceTesterActions;
21+
22+
/**
23+
* Open shop first page.
24+
*/
25+
public function openShop(): Home
26+
{
27+
$I = $this;
28+
$homePage = new Home($I);
29+
$I->amOnPage($homePage->URL);
30+
31+
return $homePage;
32+
}
33+
34+
public function loginAdmin(): AdminPanel
35+
{
36+
$I = $this;
37+
38+
$adminLoginPage = new AdminLoginPage($I);
39+
$I->amOnPage($adminLoginPage->URL);
40+
41+
$admin = Fixtures::get('admin');
42+
return $adminLoginPage->login($admin['email'], $admin['password']);
43+
}
44+
}

0 commit comments

Comments
 (0)