{"id":258982,"date":"2015-06-09T15:16:02","date_gmt":"2015-06-09T11:16:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=258982"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=258982","title":{"rendered":"\u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 RequireJS \u0432 Symfony2"},"content":{"rendered":"<p>     \t\u041d\u0430 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u0432\u0430\u0436\u043d\u043e\u0435 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043b\u044e\u0431\u044b\u0445 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u043e\u0432. \u0412\u0435\u0431 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0430 \u044f\u0432\u0430\u0441\u043a\u0440\u0438\u043f\u0442 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043a\u043e\u0441\u043d\u0435\u043c\u0441\u044f \u0442\u0430\u043a\u043e\u0433\u043e \u0447\u0430\u0441\u043d\u043e\u0433\u043e \u0441\u043b\u0443\u0447\u0430\u044f, \u043a\u0430\u043a \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 <b>RequireJS<\/b> \u0432 \u0441\u0432\u044f\u0437\u043a\u0435 \u0441 <b>Symfony2<\/b>.<\/p>\n<p>  \u0414\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435\u043c \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439, \u043f\u043e-\u044d\u0442\u043e\u043c\u0443 \u0447\u0442\u0435\u043d\u0438\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c \u0441 \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u0432 \u044d\u0442\u043e\u0439 \u0441\u0435\u0440\u0438\u0438 <a href=\"http:\/\/seclgroup.ru\/article_optimizatsiya_moduley_require_js_v_symfony2.html\">\u00ab\u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u043c\u043e\u0434\u0443\u043b\u0435\u0439 RequireJS \u0432 Symfony2\u00bb<\/a>, \u0447\u0442\u043e\u0431\u044b \u0447\u0435\u0442\u0447\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u0442\u043e, \u0447\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442.<\/p>\n<p>  \u0418\u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0438\u043c\u0435\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0435 \u043c\u043e\u0434\u0443\u043b\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u0430 \u044f\u0432\u0430\u0441\u043a\u0440\u0438\u043f\u0442\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e RequireJS, \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0442\u0430\u043a\u043e\u0439 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u044f\u0432\u0430\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432, \u043a\u0430\u043a <b>Qunit<\/b>. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043f\u0438\u0448\u0443\u0442 \u043d\u0430 \u043e\u0444\u0444\u0441\u0430\u0439\u0442\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0443\u044e html \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0443\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c\u0441\u044f \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u043c\u044b\u0435 \u0442\u0435\u0441\u0442\u044b. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u0434\u0435\u043b\u043e \u0441 Symfony2, \u043d\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440, \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u043a \u043d\u0435\u043c\u0443 \u0440\u043e\u0443\u0442 \u0438 \u043f\u043e\u0434\u0446\u0435\u043f\u0438\u0442\u044c \u0432\u044c\u044e\u0448\u043a\u0443. \u0412 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u0441\u043b\u0443\u0447\u0430\u044f, \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441 \u0434\u0435\u043b\u0430\u0442\u044c \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c \u0431\u0430\u043d\u0434\u043b\u0435, \u0438\u043b\u0438 \u0432 \u043a\u0430\u043a\u043e\u043c-\u043b\u0438\u0431\u043e \u0438\u0437 \u0443\u0436\u0435 \u0438\u043c\u0435\u044e\u0449\u0438\u0445\u0441\u044f. \u0427\u0442\u043e\u0431\u044b \u043d\u0435 \u043d\u0430\u0433\u0440\u043e\u043c\u043e\u0436\u0434\u0430\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u044e \u043b\u0438\u0448\u043d\u0438\u043c \u043a\u043e\u0434\u043e\u043c, \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 WebBundle \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043c\u044b \u044d\u0442\u043e \u0438 \u0441\u0434\u0435\u043b\u0430\u0435\u043c.<\/p>\n<p>  \u041a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e:<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<pre><code class=\"php\">#src\/Acme\/WebBundle\/Controller\/TestController.php &lt;?php namespace Acme\\WebBundle\\Controller; use Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller; class TestController extends Controller {     public function testAction()     {         return $this-&gt;render('AcmeWebBundle:Test:layout.html.twig');     } } ?&gt;<\/code><\/pre>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0440\u043d\u0443\u044e \u0432\u044c\u044e\u0448\u043a\u0443 \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u043e\u0432 \u0442\u0435\u0441\u0442\u043e\u0432, \u043a\u0430\u043a \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e\u0442 \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438:<\/p>\n<pre><code class=\"php\"> #src\/Acme\/WebBundle\/Resources\/views\/Test\/layout.html.twig &lt;!DOCTYPE html&gt;  &lt;html&gt; &lt;head&gt;     &lt;title&gt;{% block sylius_title %}QUnit tests{% endblock %}&lt;\/title&gt;     &lt;meta charset=&quot;UTF-8&quot;&gt;     &lt;!-- \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0441\u0442\u0438\u043b\u0435\u0439 \u0434\u043b\u044f QUnit --&gt;     &lt;link rel=&quot;stylesheet&quot; href=&quot;http:\/\/code.jquery.com\/qunit\/qunit-1.15.0.css&quot;\/&gt; &lt;\/head&gt; &lt;body&gt;     &lt;div id=&quot;qunit&quot;&gt;&lt;\/div&gt;     &lt;div id=&quot;qunit-fixture&quot;&gt;&lt;\/div&gt;     &lt;!-- \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c RequireJS \u0441 test.js --&gt;         {% javascripts '@AcmeWebBundle\/Resources\/assets\/js\/test.js' filter='requirejs' %}             {{ require_js_initialize({ 'main' : asset_url }) }}         {% endjavascripts %} &lt;\/body&gt; &lt;\/html&gt; <\/code><\/pre>\n<p>  \u041f\u0440\u043e\u043f\u0438\u0448\u0435\u043c \u0440\u043e\u0443\u0442 \u043a \u043d\u0430\u0448\u0435\u043c\u0443 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0443:<\/p>\n<pre><code class=\"php\">#src\/Acme\/WebBundle\/Resources\/config\/routing.yml _tests:     pattern: '\/_tests'     defaults: { _controller: AcmeWebBundle:Test:test }<\/code><\/pre>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0442\u0435\u0441\u0442\u043e\u0432 \u0441\u043e\u0437\u0434\u0430\u043d\u0430. \u0421\u0430\u043c\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u043a \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u0444\u0430\u0439\u043b\u043e\u0432 \u0434\u043b\u044f \u0441\u0430\u043c\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<p>  \u041a\u0430\u043a \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044b\u0439 \u0432 \u043d\u0430\u0448\u0435\u0439 \u0432\u044c\u044e\u0445\u0435 <b>test.js<\/b><\/p>\n<pre><code class=\"php\">#src\/Acme\/WebBundle\/Resources\/assets\/js\/test.js (function () {      &quot;use strict&quot;;      \/\/ \u041e\u0442\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0430\u0432\u0442\u043e\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0435 Qunit, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0431\u044b\u043b\u043e \u043e\u0448\u0438\u0431\u043e\u043a, \u0442\u0438\u043f\u0430     \/\/ \u00abCalled start() while already started (QUnit.config.semaphore was 0 already)\u00bb     QUnit.config.autoload = false;     QUnit.config.autostart = false;      \/\/require the unit tests.     require(         [&quot;QUnit&quot;, &quot;tests\/user\/user&quot;, &quot;tests\/user\/user2&quot;],         function (QUnit, user) {             \/\/ \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0442\u0435\u0441\u0442\u044b             user.run();             user2.run();              \/\/ \u0421\u0442\u0430\u0440\u0442\u0443\u0435\u043c QUnit.             QUnit.load();             QUnit.start();         }     ); }());<\/code><\/pre>\n<p>  \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u044d\u0442\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b\u043e\u0441\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e <a href=\"https:\/\/github.com\/hearsayit\/HearsayRequireJSBundle\">HearsayRequireJSBundle<\/a>, \u043e\u0433\u043e\u0432\u043e\u0440\u0435\u043d\u043d\u0443\u044e \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435, \u043e\u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0442 \u0432\u0438\u0434 (\u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u044b):<\/p>\n<pre><code class=\"php\"># app\/config\/config.yml hearsay_require_js:     require_js_src:  \/\/cdnjs.cloudflare.com\/ajax\/libs\/require.js\/2.1.14\/require.min.js     initialize_template: HearsayRequireJSBundle::initialize.html.twig     #\u043f\u0430\u043f\u043a\u0430 \u0432 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0431\u0443\u0434\u0443\u0442 \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u043d\u0430\u0448\u0438, \u043d\u0435 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0435,  \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0432 \u00ab\u0434\u0435\u0432\u00bb \u0432\u0435\u0440\u0441\u0438\u0438 \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 \u00abweb\u00bb.     base_url:  js     #\u043f\u0443\u0442\u044c \u043a \u043f\u0430\u043f\u043a\u0435 \u0441\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430\u043c\u0438 \u0432 \u0431\u0430\u043d\u0434\u043b\u0435     base_dir: %kernel.root_dir%\/..\/src\/Acme\/DemoBundle\/Resources\/assets\/js # Required     #\u043f\u0443\u0442\u0438 \u043a \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c \u043c\u043e\u0434\u0443\u043b\u044f\u043c \u0438 \u0441\u043a\u0440\u0438\u043f\u0442\u0430\u043c \u0434\u043b\u044f requirejs.config()     #\u0434\u043b\u044f \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u00abexternal: true\u00bb     paths:         main:             location: @AcmeDemoBundle\/Resources\/assets\/js\/main         jquery:             location: \/\/ajax.googleapis.com\/ajax\/libs\/jquery\/1.11.1\/jquery.min              external: true         underscore:             location: \/\/cdnjs.cloudflare.com\/ajax\/libs\/underscore.js\/1.6.0\/underscore-min             external: true         backbone:             location: \/\/cdnjs.cloudflare.com\/ajax\/libs\/backbone.js\/1.1.2\/backbone-min             external: true         text:             location: @AcmeDemoBundle\/Resources\/assets\/js\/vendor\/text         bootstrap:             location: \/\/maxcdn.bootstrapcdn.com\/bootstrap\/3.2.0\/js\/bootstrap.min             external: true         test:             location: @AcmeWebBundle\/Resources\/assets\/js\/test         QUnit:             location: %kernel.root_dir%\/..\/node_modules\/qunitjs\/qunit\/qunit         #\u043a\u043e\u043d\u0444\u0438\u0433  shim \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e     shim:          bootstrap:             deps: [jquery]         QUnit:             deps: [jquery]             exports: &quot;QUnit&quot;         test:             deps: [QUnit]             exports: &quot;test&quot; <\/code><\/pre>\n<p>  \u0418, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 <b>QUnit<\/b>, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u0441\u0441\u044b\u043b\u0430\u0435\u043c\u0441\u044f \u0432 <b>QUnit.location<\/b>:<\/p>\n<pre><code class=\"php\">npm install qunit <\/code><\/pre>\n<p>  \u0412 \u043a\u0443\u043b\u044c\u043c\u0438\u043d\u0430\u0446\u0438\u0438 \u043f\u0438\u0448\u0435\u043c \u043d\u0430\u0448\u0438 \u043f\u0435\u0440\u0432\u044b\u0435 \u0442\u0435\u0441\u0442\u044b:<\/p>\n<pre><code class=\"php\">#src\/Acme\/WebBundle\/Resources\/assets\/js\/tests\/user\/user.js define(     [&quot;QUnit&quot;, &quot;bundles\/user\/models\/user&quot;],     function (QUnit, User) {          &quot;use strict&quot;;          var run = function () {             QUnit.module(&quot;\u0422\u0435\u0441\u0442 \u0434\u043b\u044f Backbone \u043c\u043e\u0434\u0435\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f&quot;);              QUnit.test(&quot;\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0441\u0442\u044c \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439&quot;, function () {              \/\/ \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u044b\u0445 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a             QUnit.expect(3);              var user = new User();             \/\/ \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f             QUnit.equal(user.get(&quot;name&quot;), &quot;User name&quot;, &quot;\u0414\u0435\u0444\u043e\u043b\u0442\u043d\u043e\u0435 \u0438\u043c\u044f \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 'User name'&quot;);             QUnit.equal(user.get(&quot;email&quot;), &quot;example@example.com&quot;, &quot;\u0414\u0435\u0444\u043e\u043b\u0442\u043ds\u044b\u0439 Email \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 'example@example.com'&quot;);             QUnit.equal(user.get(&quot;telephone&quot;), &quot;111-11-11&quot;, &quot;\u0414\u0435\u0444\u043e\u043b\u0442\u043ds\u044b\u0439 \u0442\u0435\u043b\u0435\u0444\u043e\u043d \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 '111-11-11'&quot;);         });         return {run: run}     } );  #src\/Acme\/WebBundle\/Resources\/assets\/js\/tests\/user\/user2.js define(     [&quot;QUnit&quot;, &quot;bundles\/user\/models\/user&quot;],     function (QUnit, User) {          &quot;use strict&quot;;          var run = function () {             QUnit.module(&quot;\u0422\u0435\u0441\u04422 \u0434\u043b\u044f Backbone \u043c\u043e\u0434\u0435\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f&quot;);              QUnit.test(&quot;\u041c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d \u043e\u0431\u044a\u0435\u043a\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u044b \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e \u0434\u0435\u0444\u043e\u043b\u0442\u0443&quot;, function () {                  QUnit.expect(3);                  \/\/ \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442 User \u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c\u0438 \u043d\u0435\u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438                 var user = new User({                     name: &quot;Vasily Pupkin&quot;,                     email: &quot;vasily@pupkin.com&quot;,                     telephone: &quot;333-22-11&quot;                 });                  \/\/ \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439                 QUnit.equal(user.get(&quot;name&quot;), &quot;Vasily Pupkin&quot;, &quot;Name Correct!&quot;);                 QUnit.equal(user.get(&quot;email&quot;), &quot;vasily@pupkin.com&quot;, &quot;Email Correct!&quot;);                 QUnit.equal(user.get(&quot;telephone&quot;), &quot;333-22-11&quot;, &quot;Telephone Correct!&quot;);             });         };         return {run: run}     } ); <\/code><\/pre>\n<p>  \u041d\u0430\u043f\u0438\u0448\u0435\u043c \u043c\u043e\u0434\u0435\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0442\u0432\u0435\u0447\u0430\u043b\u0430 \u0431\u044b \u043d\u0430\u0448\u0438\u043c \u0442\u0435\u0441\u0442\u0430\u043c:<\/p>\n<pre><code class=\"php\">#src\/Acme\/WebBundle\/Resources\/assets\/js\/bundles\/user\/models\/user.js define([&quot;backbone&quot;], function (Backbone) {      &quot;use strict&quot;;      return Backbone.Model.extend({         defaults: {             name: &quot;User name&quot;,             email: &quot;example@example.com&quot;,             telephone: &quot;111-11-11&quot;         }     }); });<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c, \u0435\u0441\u043b\u0438 \u043c\u044b \u043e\u0431\u0440\u0430\u0442\u0438\u043c\u0441\u044f \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 <a href=\"http:\/\/example.com\/_tests\">http:\/\/example.com\/_tests<\/a> (\u00abexample.com\u00bb \u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0430 \u0441\u0432\u043e\u0439 \u0434\u0435\u0432\u0435\u043b\u043e\u043f\u0435\u0440\u0441\u043a\u0438\u0439 \u0445\u043e\u0441\u0442), \u0442\u043e \u0441\u043c\u043e\u0436\u0435\u043c \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<p>  \u0414\u043b\u044f \u043b\u0443\u0447\u0448\u0435\u0433\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0438 \u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0438 \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0441\u043e\u0432\u0435\u0442\u0443\u044e \u043f\u0440\u043e\u0447\u0435\u0441\u0442\u044c \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0443\u044e \u0441\u0442\u0430\u0442\u044c\u044e.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/files\/691\/a11\/367\/691a11367dee4fd3b4a9f504bb6aab68.png\" alt=\"image\"\/><\/p>\n<p>  \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043d\u0435\u0445\u0438\u0442\u0440\u043e\u0439 \u043f\u0440\u043e\u0434\u0435\u043b\u0430\u043d\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c RequireJS \u043c\u043e\u0434\u0443\u043b\u0438 \u043d\u0430\u0448\u0435\u0433\u043e \u044f\u0432\u0430\u0441\u043a\u0440\u0438\u043f\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 Symfony2, \u043a\u0430\u043a \u0432 \u00ab\u0434\u0435\u0432\u00bb, \u0442\u0430\u043a \u0438 \u0432 \u00ab\u043f\u0440\u043e\u0434\u00bb \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0438. \u0425\u043e\u0447\u0443 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u044d\u0442\u043e \u043b\u0438\u0448\u044c \u043e\u0434\u0438\u043d \u0438\u0437 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432 \u043a \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e JS \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u043d\u0435 \u043f\u0440\u0435\u0442\u0435\u043d\u0434\u0443\u0435\u0442 \u043d\u0430 \u0437\u0432\u0430\u043d\u0438\u0435 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0434\u043b\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0439.     \t<\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/259901\/\"> http:\/\/habrahabr.ru\/post\/259901\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>     \t\u041d\u0430 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u0432\u0430\u0436\u043d\u043e\u0435 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043b\u044e\u0431\u044b\u0445 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u043e\u0432. \u0412\u0435\u0431 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0430 \u044f\u0432\u0430\u0441\u043a\u0440\u0438\u043f\u0442 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043a\u043e\u0441\u043d\u0435\u043c\u0441\u044f \u0442\u0430\u043a\u043e\u0433\u043e \u0447\u0430\u0441\u043d\u043e\u0433\u043e \u0441\u043b\u0443\u0447\u0430\u044f, \u043a\u0430\u043a \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 <b>RequireJS<\/b> \u0432 \u0441\u0432\u044f\u0437\u043a\u0435 \u0441 <b>Symfony2<\/b>.<\/p>\n<p>  \u0414\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435\u043c \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439, \u043f\u043e-\u044d\u0442\u043e\u043c\u0443 \u0447\u0442\u0435\u043d\u0438\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c \u0441 \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u0432 \u044d\u0442\u043e\u0439 \u0441\u0435\u0440\u0438\u0438 <a href=\"http:\/\/seclgroup.ru\/article_optimizatsiya_moduley_require_js_v_symfony2.html\">\u00ab\u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u043c\u043e\u0434\u0443\u043b\u0435\u0439 RequireJS \u0432 Symfony2\u00bb<\/a>, \u0447\u0442\u043e\u0431\u044b \u0447\u0435\u0442\u0447\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u0442\u043e, \u0447\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442.<\/p>\n<p>  \u0418\u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0438\u043c\u0435\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0435 \u043c\u043e\u0434\u0443\u043b\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u0430 \u044f\u0432\u0430\u0441\u043a\u0440\u0438\u043f\u0442\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e RequireJS, \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0442\u0430\u043a\u043e\u0439 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u044f\u0432\u0430\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432, \u043a\u0430\u043a <b>Qunit<\/b>. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043f\u0438\u0448\u0443\u0442 \u043d\u0430 \u043e\u0444\u0444\u0441\u0430\u0439\u0442\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0443\u044e html \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0443\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c\u0441\u044f \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u043c\u044b\u0435 \u0442\u0435\u0441\u0442\u044b. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u0434\u0435\u043b\u043e \u0441 Symfony2, \u043d\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440, \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u043a \u043d\u0435\u043c\u0443 \u0440\u043e\u0443\u0442 \u0438 \u043f\u043e\u0434\u0446\u0435\u043f\u0438\u0442\u044c \u0432\u044c\u044e\u0448\u043a\u0443. \u0412 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u0441\u043b\u0443\u0447\u0430\u044f, \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441 \u0434\u0435\u043b\u0430\u0442\u044c \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c \u0431\u0430\u043d\u0434\u043b\u0435, \u0438\u043b\u0438 \u0432 \u043a\u0430\u043a\u043e\u043c-\u043b\u0438\u0431\u043e \u0438\u0437 \u0443\u0436\u0435 \u0438\u043c\u0435\u044e\u0449\u0438\u0445\u0441\u044f. \u0427\u0442\u043e\u0431\u044b \u043d\u0435 \u043d\u0430\u0433\u0440\u043e\u043c\u043e\u0436\u0434\u0430\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u044e \u043b\u0438\u0448\u043d\u0438\u043c \u043a\u043e\u0434\u043e\u043c, \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 WebBundle \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043c\u044b \u044d\u0442\u043e \u0438 \u0441\u0434\u0435\u043b\u0430\u0435\u043c.<\/p>\n<p>  \u041a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e:  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-258982","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/258982","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=258982"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/258982\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=258982"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=258982"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=258982"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}