Licitator 1.0
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

175 lines
5.4 KiB

5 years ago
  1. # Introduction
  2. Prometeo Commands is a symfony bundle that allows you to build automatically entities, sonata admins, unit test cases, functional test cases and user documentation.
  3. A demo site?
  4. ## Installation
  5. ### Minimum requirements
  6. - Symfony 4.0
  7. - PHP 7.1.3
  8. - Twig 2.0
  9. ### Composer installation
  10. You can install it through composer.
  11. ```json
  12. {
  13. ....
  14. "require":{
  15. "prometeo/prometeo-command": "@dev"
  16. }
  17. ....
  18. "repositories": [
  19. {
  20. "type": "path",
  21. "url": "repositories/prometeo-commands",
  22. "options": {
  23. "symlink": true
  24. }
  25. }
  26. ],
  27. ....
  28. }
  29. ```
  30. ### Enable bundle
  31. Then, enable the bundle by adding it to the list of registered bundles in the `config/bundles.php` file of your project:
  32. ```php
  33. <?php
  34. return [
  35. // ...
  36. Prometeo\CommandsBundle\PrometeoCommandsBundle::class => ['all' => true],
  37. ];
  38. ```
  39. ### Add services
  40. Add to services.yml
  41. ```yaml
  42. prometeo.admin.maker:
  43. class: Prometeo\CommandsBundle\Commands\MakeAdmin
  44. arguments:
  45. - '@doctrine.orm.entity_manager'
  46. - collection:
  47. - maker.command
  48. tags:
  49. - { name: 'admin.maker.command', command: 'prometeo:make:admin' }
  50. prometeo.entities.maker:
  51. class: Prometeo\CommandsBundle\Commands\MakeEntities
  52. arguments: ['%kernel.project_dir%','@doctrine.orm.entity_manager', ['maker.command']]
  53. tags:
  54. - { name: 'entities.maker.command', command: 'prometeo:make:entities' }
  55. prometeo.usermanual.maker:
  56. class: Prometeo\CommandsBundle\Commands\MakeUserManual
  57. arguments: ['%kernel.project_dir%','@doctrine.orm.entity_manager']
  58. tags:
  59. - { name: 'usermanual.maker.command', command: 'prometeo:make:entities' }
  60. prometeo.skipper.generate:
  61. class: Prometeo\CommandsBundle\Commands\GenerateSkipper
  62. arguments: ["@service_container",'%kernel.project_dir%','@doctrine.orm.entity_manager']
  63. tags:
  64. - { name: 'skipper.generate.command', command: 'prometeo:skipper:generate' }
  65. prometeo.screenshots.generate:
  66. class: Prometeo\CommandsBundle\Commands\GenerateScreenshoots
  67. arguments: ["@service_container",'%kernel.project_dir%','@doctrine.orm.entity_manager']
  68. tags:
  69. - { name: 'screenshots.generate.command', command: 'prometeo:screenshots:generate' }
  70. prometeo.unittest.maker:
  71. class: Prometeo\CommandsBundle\Commands\MakeUnitTest
  72. arguments: ['%kernel.project_dir%','@doctrine.orm.entity_manager']
  73. tags:
  74. - { name: 'screenshots.generate.command', command: 'prometeo:make:unit-test' }
  75. prometeo.functionaltest.make:
  76. class: Prometeo\CommandsBundle\Commands\MakeFunctionalTest
  77. arguments: ['%kernel.project_dir%','@doctrine.orm.entity_manager']
  78. tags:
  79. - { name: 'screenshots.generate.command', command: 'prometeo:make:functional-test' }
  80. ```
  81. ### PHPunit config
  82. ```
  83. <!-- phpunit.xml.dist -->
  84. <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  85. xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/6.0/phpunit.xsd"
  86. backupGlobals="false"
  87. colors="true"
  88. bootstrap="vendor/autoload.php"
  89. >
  90. <php>
  91. <ini name="error_reporting" value="-1" />
  92. <env name="KERNEL_CLASS" value="App\Kernel" />
  93. <env name="APP_ENV" value="test" />
  94. <env name="APP_DEBUG" value="1" />
  95. <env name="SHELL_VERBOSITY" value="-1" />
  96. <env name="DATABASE_URL" value="mysql://[user:password]@127.0.0.1:3306/[database]?serverVersion=[version]" />
  97. <!-- define your env variables for the test env here -->
  98. </php>
  99. <!-- ... -->
  100. <testsuites>
  101. <testsuite name="Project Test Suite">
  102. <directory>tests</directory>
  103. </testsuite>
  104. </testsuites>
  105. <!-- Add this for PHPUnit 7.5 or higher -->
  106. <!-- <extensions>-->
  107. <!-- <extension class="DAMA\DoctrineTestBundle\PHPUnit\PHPUnitExtension"/>-->
  108. <!-- </extensions>-->
  109. <listeners>
  110. <listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener"/>
  111. </listeners>
  112. </phpunit>
  113. ```
  114. # Usage
  115. ## How to use
  116. #### Make entities
  117. ```shell script
  118. cd src/Entity
  119. for file in *;
  120. do
  121. echo "../../bin/console make:entity App\\Entity\\${file::-4}";
  122. ../../bin/console make:entity --regenerate --overwrite "App\\Entity\\${file::-4}";
  123. done
  124. ```
  125. #### Make Sonata Admins
  126. ```shell script
  127. cd src/Entity
  128. for file in *;
  129. do
  130. withoutext=${file::-4}
  131. echo "../../bin/console make:sonata:admin \"App\\Entity\\${file::-4}\" --admin ${file::-4}Admin --controller ${file::-4}AdminController --services services.yaml --id admin.${withoutext,,}";
  132. ../../bin/console make:sonata:admin \"App\\Entity\\${file::-4}\" --admin ${file::-4}Admin --controller ${file::-4}AdminController --services services.yaml --id admin.${withoutext,,}
  133. done
  134. ```
  135. #### Generate Screen Shoots
  136. ```shell script
  137. bin/console debug:router --raw >adminlist.txt
  138. php filterlist.php
  139. ./phantomjs.exe --ssl-protocol=any --ignore-ssl-errors=yes phantomjs/testscripts/sonatatest.js acdr.test %1 %2 %3
  140. ```
  141. #### Make Unit Test
  142. ```shell script
  143. cd src/Entity
  144. for file in *;
  145. do
  146. echo "../../bin/console prometeo:make:unit-test Entity\\${file::-4} Entity";
  147. ../../bin/console prometeo:make:unit-test "Entity\\${file::-4}" Entity
  148. done
  149. ```
  150. #### Make Functional Test
  151. #### Make User Manual
  152. That's it! Done!
  153. ## Additional documentation: