Skip to content

Commit

Permalink
Use config for upload directory and media cache directory in Media
Browse files Browse the repository at this point in the history
controller. Prepare movin index.php to public. Cope with #72

Add PHPUnit test. Keep going with PHPUnit or try to make same tests
with Atoum ?
  • Loading branch information
nikrou committed Mar 19, 2021
1 parent bd4817c commit 36e4f36
Show file tree
Hide file tree
Showing 19 changed files with 331 additions and 182 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/phyxo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ jobs:
- name: Unit tests
run: ./bin/atoum

- name: PHPUnit tests
run: ./bin/simple-phpunit --testdox

- name: Create database
run: ./bin/console doctrine:database:create -vvv

Expand Down
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,12 @@ behat.yml
/.php_cs.cache
###< friendsofphp/php-cs-fixer ###
/install/queries.sql

/tests/media
/tests/upload

###> symfony/phpunit-bridge ###
.phpunit
.phpunit.result.cache
/phpunit.xml
###< symfony/phpunit-bridge ###
6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "^0.12.42",
"phpstan/phpstan-doctrine": "^0.12.19",
"symfony/browser-kit": "^4.4",
"symfony/css-selector": "^4.4",
"symfony/maker-bundle": "^1.21",
"symfony/profiler-pack": "^1.0",
"symfony/test-pack": "^1.0"
"symfony/phpunit-bridge": "^5.2",
"symfony/profiler-pack": "^1.0"
},
"config": {
"preferred-install": {
Expand Down
72 changes: 29 additions & 43 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions config/parameters_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
parameters:
upload_dir: '%kernel.project_dir%/tests/upload'
media_cache_dir: '%kernel.project_dir%/tests/media'
6 changes: 6 additions & 0 deletions config/services_test.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
imports:
- { resource: parameters_test.yaml }

services:
_defaults:
autowire: true
Expand Down Expand Up @@ -29,3 +32,6 @@ services:

phyxo.comment.mapper:
alias: 'App\DataMapper\CommentMapper'

phyxo.image.repository:
alias: 'App\Repository\ImageRepository'
28 changes: 28 additions & 0 deletions features/web/media.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Feature: Image
In order to discover the gallery
As a user
I need to be able to show images in differents size

Background: init
Given a user:
| username | password | status |
| user1 | pass1 | normal |

And an album:
| name | status |
| album 1 | public |

And an image:
| name | album |
| photo 1.1 | album 1 |


Scenario: See images
Given I am logged in as "user1" with password "pass1"
And I follow "album 1"
And I follow "photo 1"
And I follow image of type "small"
Then the response status code should be 200



10 changes: 0 additions & 10 deletions include/config_default.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -430,16 +430,6 @@
// Every plugin from 1.7 would be design to manage light_slideshow case.
$conf['light_slideshow'] = true;

// the local data directory is used to store data such as compiled templates,
// plugin variables, or resized images. Beware of
// mandatory trailing slash.
$conf['data_location'] = '_data/';

// where should the API/UploadForm add photos? This path must be relative to
// the Phyxo installation directory (but can be outside, as long as it's
// reachable from your webserver).
$conf['upload_dir'] = './upload';

// enable the synchronization method for adding photos
$conf['enable_synchronization'] = false;

Expand Down
40 changes: 40 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>

<!-- https://phpunit.readthedocs.io/en/latest/configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="bin/.phpunit/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="config/bootstrap.php"
>
<php>
<ini name="error_reporting" value="-1" />
<server name="APP_ENV" value="test" force="true" />
<server name="SHELL_VERBOSITY" value="-1" />
<server name="SYMFONY_PHPUNIT_REMOVE" value="" />
<server name="SYMFONY_PHPUNIT_VERSION" value="8.5" />
</php>

<testsuites>
<testsuite name="Project Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>

<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src</directory>
</whitelist>
</filter>

<listeners>
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" />
</listeners>

<!-- Run `composer require symfony/panther` before enabling this extension -->
<!--
<extensions>
<extension class="Symfony\Component\Panther\ServerExtension" />
</extensions>
-->
</phpunit>
Loading

0 comments on commit 36e4f36

Please sign in to comment.