Hi, Habrasoobschestvo!
In the footsteps of the recently held
DevConf 2012 conference, I want to share notes from my notebook that I personally found most interesting and useful. Perhaps someone is well aware of this. Since the reports were made simultaneously in several halls, it was impossible to visit all of them, so I’m happy to read your additions in the comments.
Topics that primarily interested me are:
- system deployment and continuous integration (Continuous Integration)
- PHP 5.4, PHPUnit, Yii
- testing in javascript
System Deployment and Continuous Integration (CI)
Deployment of the system turned out to be a popular topic of the conference, there were 3 or 4 reports. For myself, I described it this way: a continuous integration server is installed, which, for example, collects your project from the repository every night, runs tests, checks the code for potential jambs and sends you a report. In the morning, you watch this report and immediately see how you are doing with the project. Another advantage is the ability to show managers a ready-made working version of the project at any time, and there’s also a clear understanding of what’s ready and what’s not.
As a
continuous integration server , the following were mentioned:
-
jenkinsThere are many plugins, incl. the most important plugin is Chuck Noris)
-
teamcitymore pleasant web interface than jenkins
-
phpundercontrol- something else
As a
project build system you can use:
-
bash script-
capistranoMade for Ruby, but can also be used for php. No special knowledge of Ruby is required. For symfony, there is a special version of capifony.
-
phingwritten in php, there are many ready-made tasks. Build is described as xml-files. From the shortcomings I heard the absence of the possibility of a rollback from the default delivery (you need to write yourself).
')
PHPUnit is used as standard for
testing PHP code . On the sidelines, we also talked about
Codeception , that it is more oriented towards testers (there was a
post about it on Habré)
The test methods themselves can be conveniently written using the GIVEN-WHEN-THEN pattern (that is, by beating the blocks directly with comments):
function testMethodAbc() {
There are some good tools for
analyzing PHP code that can also be run automatically when building or committing:
-
Lint (syntax verification)
-
PHP_CodeSniffer (coding standard compliance)
-
phploc (
various statistics such as number of comments, etc.)
-
PHP_Depend (code analysis, for example, calculation of different coefficients such as class connectivity, etc.)
-
PHP_Mess Detector (search for potential jambs in the code)
-
PHP_Code Coverage (code coverage with tests, comes with PHPUnit)
-
PHP Copy / Paste detector (guess yourself :))
DbDeploy was advised to the
database deployment account . Migrations are used, but written only in one direction. This is also because it is not always possible in principle to write a reverse migration (for example, when deleting a table). A good piece of advice is to test the deployment of the database on a test server, first merging a copy of the working database onto it, because The source of errors may be the data itself.
Well, regarding the very
sequence of project deployment , the following scheme was useful to me:
1. unpack the sources into a new folder
2. pull up dependent libraries
3. roll database updates
4. throw symlink to the new version
5. throw symlink on user data
6. * run tests. in case of error - rollback. (for test server)
7. send emails to users / managers about the release of the new version
What's new in PHP 5.4
as the author himself said PHP 5.4 = PHP6.0 - Unicode.
The main innovations are:
- impurities (traits),
- use [] for arrays
- embedded web server
It was also helpful to know that minor releases 5.4.5 and 5.4.6 will be released in the next two months.
There were interesting questions:
Q1: Unicode ... when?
A1: May be year, may be years, may never ... We need your support!
Q2: What about integrating APC into PHP?
A2: APC is not stable enough sometimes sometimes ..Yii / Yii2
It was interesting to talk with Alexander Makarov (
SamDark ) - one of the core developers of the framework. The main questions concerned
Yii2 :
- Yii2 release date is kept secret
- there are now three active members in the team + github-community, where everyone is invited to support and develop the project
- in Yii2, ActiveRecord will undergo major changes and will be divided into the model itself and the Query object, which will replace the existing DbCriteria
- only two of the links will remain: HAS_ONE and HAS_MANY. They promise to implement the automatic saving of Related models for the parent
- twitter bootstrap will appear in the interface
- there were still some improvements, but I did not remember them
Testing in JS
For testing JS there is a special framework from Yahoo:
YUI Test Framework . All this works through Selenium, i.e. need to put an additional driver. He can even calculate code coverage for js code.
To simulate ajax responses from the server, advised
Sinon.js . It can be quite flexible to configure different answers.
For small projects,
jsTestDriver was also recommended as a more lightweight solution (Selenium is not needed), but also less rich in functionality.
Total
That’s all I got from the bottom line.
I believe that the conference was very useful and informative. If you have something to add - write.
Thanks to all the speakers, as well as the organizers for the delicious cakes in the breaks.
UPD:Links to some reports and photos:
1.
PHP Performance (Rasmus Lerdorf) (thanks to
SamDark , flip arrows)
2.
Vorotilin Dmitry talks about Sprockets (thanks to @ py3u)
3.
Yegor Khomyakov talks about the vulnerability in OAuth (thanks to @ py3u)
4.
Some photos and conference report (thanks
zizop )