What interesting things did I learn at DevConf 2012

    Hello, Habrasociety!
    Following the traces of the recent DevConf 2012 conference, I want to share notes from my notebook that I personally found the most interesting and useful. Perhaps someone knows all this well. Since the reports were presented simultaneously in several rooms, it was impossible to visit all of them, so I would like to read your additions in the comments.
    The topics that primarily interested me were:
    - system deployment and continuous integration (Continuous Integration)
    - PHP 5.4, PHPUnit, Yii
    - javascript testing


    System Deployment and Continuous Integration (CI)


    The 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 opportunity at any time to show managers the finished working version of the project, and a clear understanding of what is ready and what is not.
    The following were mentioned as the continuous integration server :
    - jenkins
    has many plugins, including the most important plugin is Chuck Noris)
    - teamcity
    a nicer web interface than jenkins
    - phpundercontrol
    - something else

    As a project build system you can use:
    - a bash script
    - capistrano
    is made for Ruby, but can be used for php as well. No special knowledge of Ruby is required. There is a special version of capifony for symfony.
    - phing is
    written in php, there are many ready-made tasks. The build is described as xml files. Of the shortcomings I heard the lack of the possibility of a rollback from the default delivery (you need to write yourself).

    To test PHP code , PHPUnit is standardly used . On the sidelines talking more about CodeceptionThat it is more focused on testers (there was a post about him ) It’s
    convenient to write the test methods themselves using the GIVEN-WHEN-THEN template (that is, beating these blocks directly with comments):
    function testMethodAbc() 
    {
        //given
        $a = new Object();
        $a->x = 123;
        //when
        $a->methodAbc();
        //then
        $this->assertTrue($a->x);
    }
    


    There are several good tools for analyzing PHP code that can also be run automatically during assembly or commit:
    - Lint (syntax verification)
    - PHP_CodeSniffer (compliance with the coding standard)
    - phploc (different statistics such as number of comments, etc.)
    - PHP_Depend (code analysis, for example, calculating different coefficients such as class connectivity, etc.)
    - PHP_Mess Detector (searching for potential jambs in the code)
    - PHP_Code Coverage (covering the code with tests, comes with PHPUnit)
    - PHP Copy / Paste detector (guess for yourself :))

    At the expense of the deployment database advised dbDeploy . Migrations are used, but written only in one direction. Including 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 base deployment on a test server by first dumping a copy of the working base onto it, because The source of errors may be the data itself.

    Well, as for the project deployment sequence itself, the following scheme was useful to me:
    1. unzip the sources into a new folder
    2. pull up the dependent libraries
    3. roll up the database updates
    4. transfer symlink to the new version
    5. transfer symlink to user data
    6. * run the tests. in case of an error - rollback. (for test server)
    7. send emails to users / managers about new version release

    What's New in PHP 5.4


    as the author of PHP 5.4 = PHP6.0 - Unicode said.
    The main innovations are:
    - traits,
    - use of [] for arrays
    - built-in web server.

    It was also useful to know that minor releases 5.4.5 and 5.4.6 will be released within the next two months.
    There were interesting questions:
    Q1: Unicode ... when?
    A1: May be year, may be ten years, may be never ... We need your support!

    Q2: What about integrating APC into PHP?
    A2: We are working on it, but APC is not stable enough 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 :
    - the release date of Yii2 is still kept secret
    - the team now has three active participants + a github community where everyone is invited to support and develop the project
    - in Yii2 ActiveRecord will undergo strong changes and will be divided directly into the Query model and object , which will replace the existing DbCriteria
    - only two of the links will remain: HAS_ONE and HAS_MANY. They promise to implement automatic saving of Related models for the parent
    - twitter bootstrap will appear in the interface
    - there were some other 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 install an additional driver. It will even be able to calculate code coverage for js code.
    To simulate ajax responses from the server, Sinon.js was advised . In it, you can quite flexibly configure different answer options.
    For small projects, we also recommended jsTestDriver as a more lightweight solution (Selenium is not needed) but also less rich functionality.

    Total


    That's all that in the bottom line happened to me.
    I believe that the conference was very useful and informative. If you have something to add - write.
    Thanks to all the speakers and the organizers for the delicious cakes during the breaks.

    UPD:
    Links to some reports and photos:
    1. PHP Performance (Rasmus Lerdorf) (thanks SamDark , flipping arrows)
    2. Vorotilin Dmitry talks about Sprockets (thanks @ py3u)
    3. Yegor Khomyakov talks about vulnerabilities in OAuth (thanks @ py3u)
    4. Some photos and conference report (thanks zizop )

    Also popular now: