42 $result = $this->process->requireJs($json);
43 $this->assertEquals($expected,
$result);
51 if (typeof require !==
"undefined" && require.config) {
52 require.config(components);
54 var require = components;
56 if (typeof exports !==
"undefined" && typeof module !==
"undefined") {
57 module.exports = components;
63 array(
'foo' =>
'bar'),
64 sprintf(
$js,
"{\n \"foo\": \"bar\"\n}"),
80 $this->composer->getConfig()->merge(
array(
'config' => $config));
81 $this->process->init();
82 $result = $this->process->requireJson($packages);
83 $this->assertEquals($expected,
$result);
89 $packageWithoutExtra =
array(
90 'name' =>
'components/packagewithoutextra',
91 'type' =>
'component',
93 $packages =
array($packageWithoutExtra);
95 'baseUrl' =>
'components',
97 $tests[] =
array($packages,
array(), $expected);
100 $packages =
array($packageWithoutExtra);
102 'baseUrl' =>
'components',
104 $tests[] =
array($packages,
array(
'component-dir' =>
'otherdir'), $expected);
107 $packages =
array($packageWithoutExtra);
109 'baseUrl' =>
'/another/path',
111 $tests[] =
array($packages,
array(
'component-baseurl' =>
'/another/path'), $expected);
115 'name' =>
'components/jquery',
116 'type' =>
'component',
118 'component' =>
array(
125 $packages =
array($jquery);
127 'baseUrl' =>
'components',
129 $tests[] =
array($packages,
array(), $expected);
133 'name' =>
'components/underscore',
134 'type' =>
'component',
136 'component' =>
array(
142 'baseUrl' =>
'components',
144 $packages =
array($underscore);
147 'underscore' =>
array(
151 'baseUrl' =>
'components',
153 $tests[] =
array($packages,
array(), $expected);
157 'name' =>
'components/backbone',
158 'type' =>
'component',
160 'component' =>
array(
165 'exports' =>
'Backbone',
174 $packages =
array($backbone);
178 'exports' =>
'Backbone',
185 'baseUrl' =>
'components',
187 $tests[] =
array($packages,
array(), $expected);
190 $packages =
array($backbone, $jquery);
194 'exports' =>
'Backbone',
201 'baseUrl' =>
'components',
203 $tests[] =
array($packages,
array(), $expected);
206 $packageWithConfig =
array(
207 'name' =>
'components/packagewithconfig',
208 'type' =>
'component',
210 'component' =>
array(
217 $packages =
array($packageWithConfig);
220 'packagewithconfig' =>
array(
224 'baseUrl' =>
'components',
226 $tests[] =
array($packages,
array(), $expected);
229 $packageWithScripts =
array(
230 'name' =>
'components/foobar',
231 'type' =>
'component',
233 'component' =>
array(
235 'tests/ComponentInstaller/Test/Resources/test.js',
241 $packages =
array($packageWithScripts);
246 'main' =>
'foobar-built.js' 249 'baseUrl' =>
'components',
251 $tests[] =
array($packages,
array(), $expected);
254 $packageWithScripts =
array(
255 'name' =>
'components/foobar2',
257 'component' =>
array(
259 'tests/ComponentInstaller/Test/Resources/*.js',
265 $packages =
array($packageWithScripts);
270 'main' =>
'foobar2-built.js' 273 'baseUrl' =>
'components',
275 $tests[] =
array($packages,
array(), $expected);
279 'name' =>
'components/foobar3',
281 'component' =>
array(
288 $packages =
array($package);
290 'component' =>
array(
292 'baseUrl' =>
'public',
301 'baseUrl' =>
'public',
308 'name' =>
'components/foobar3',
310 'component' =>
array(
317 $packages =
array($package);
319 'component' =>
array(
321 'baseUrl' =>
'public',
335 'baseUrl' =>
'public',
testRequireJson(array $packages, array $config, $expected=null)
testRequireJson
Builds the require.js configuration.
Create styles array
The data for the language used.
testRequireJs(array $json=array(), $expected='')
testRequireJs