diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..155da2e --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Shopware + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/bin/phpunit.sh b/bin/phpunit.sh new file mode 100755 index 0000000..1a0096a --- /dev/null +++ b/bin/phpunit.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +./../../../vendor/bin/phpunit \ No newline at end of file diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..c834069 --- /dev/null +++ b/composer.json @@ -0,0 +1,31 @@ +{ + "name": "swag/new-tab", + "description": "Example plugin which adds a new tab to the product detail page", + "version": "v1.0.0", + "type": "shopware-platform-plugin", + "license": "MIT", + "authors": [ + { + "name": "shopware AG" + } + ], + "require": { + "shopware/platform": "dev-master" + }, + "extra": { + "shopware-plugin-class": "Swag\\NewTab\\NewTab", + "label": { + "de-DE": "Beispiel Plugin, welches einen neuen Tab der Produkt Detailseite hinzufügt", + "en-GB": "Example plugin which adds a new tab to the product detail page" + }, + "description": { + "de-DE": "Beispiel Plugin, welches einen neuen Tab der Produkt Detailseite hinzufügt", + "en-GB": "Example plugin which adds a new tab to the product detail page" + } + }, + "autoload": { + "psr-4": { + "Swag\\NewTab\\": "src/" + } + } +} \ No newline at end of file diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 0000000..f801583 --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + tests + + + + + + ./ + + + \ No newline at end of file diff --git a/src/NewTab.php b/src/NewTab.php new file mode 100644 index 0000000..5c3de8a --- /dev/null +++ b/src/NewTab.php @@ -0,0 +1,9 @@ + + Custom + +{% endblock %} \ No newline at end of file diff --git a/src/Resources/administration/view/sw-product-detail-custom/index.js b/src/Resources/administration/view/sw-product-detail-custom/index.js new file mode 100644 index 0000000..cf3202f --- /dev/null +++ b/src/Resources/administration/view/sw-product-detail-custom/index.js @@ -0,0 +1,12 @@ +import { Component } from 'src/core/shopware'; +import template from './sw-product-detail-custom.html.twig'; + +Component.register('sw-product-detail-custom', { + template, + + metaInfo() { + return { + title: 'Custom' + }; + }, +}); diff --git a/src/Resources/administration/view/sw-product-detail-custom/sw-product-detail-custom.html.twig b/src/Resources/administration/view/sw-product-detail-custom/sw-product-detail-custom.html.twig new file mode 100644 index 0000000..31db6aa --- /dev/null +++ b/src/Resources/administration/view/sw-product-detail-custom/sw-product-detail-custom.html.twig @@ -0,0 +1,3 @@ + + Hello! + \ No newline at end of file diff --git a/tests/UsedClassesAvailableTest.php b/tests/UsedClassesAvailableTest.php new file mode 100644 index 0000000..e3cc05c --- /dev/null +++ b/tests/UsedClassesAvailableTest.php @@ -0,0 +1,36 @@ +getPluginClasses() as $class) { + $classRelativePath = str_replace(['.php', '/'], ['', '\\'], $class->getRelativePathname()); + + $this->getMockBuilder($namespace . '\\' . $classRelativePath) + ->disableOriginalConstructor() + ->getMock(); + } + + // Nothing broke so far, classes seem to be instantiable + $this->assertTrue(true); + } + + private function getPluginClasses(): Finder + { + $finder = new Finder(); + $finder->in(realpath(__DIR__ . '/../')); + $finder->exclude('Test'); + return $finder->files()->name('*.php'); + } +} \ No newline at end of file