Best Mockery code snippet using is.buildFactory
TagInputTest.php
Source:TagInputTest.php
...20 public function setUp() : void21 {22 $this->name_source = new DefNamesource();23 }24 protected function buildFactory()25 {26 $df = new Data\Factory();27 $language = $this->createMock(\ilLanguage::class);28 return new ILIAS\UI\Implementation\Component\Input\Field\Factory(29 new SignalGenerator(),30 $df,31 new \ILIAS\Refinery\Factory($df, $language),32 $language33 );34 }35 /**36 * @doesNotPerformAssertions37 */38 public function test_implements_factory_interface()39 {40 $f = $this->buildFactory();41 $tag = $f->tag(42 "label",43 ["lorem", "ipsum", "dolor",],44 "byline"45 );46 }47 /**48 *49 */50 public function test_render()51 {52 $f = $this->buildFactory();53 $label = "label";54 $byline = "byline";55 $tags = ["lorem", "ipsum", "dolor",];56 $name = "name_0";57 $text = $f->tag($label, $tags, $byline)->withNameFrom($this->name_source);58 $r = $this->getDefaultRenderer();59 $html = $this->normalizeHTML($r->render($text));60 $expected = "<div class=\"form-group row\"> <label for=\"name_0\" class=\"control-label col-sm-3\">label</label> <div class=\"col-sm-9\"> <div id=\"container-id_1\" class=\"form-control form-control-sm il-input-tag\"> <input type=\"text\" id=\"id_1\" value=\"\" class=\"form-control form-control-sm\"/> <input type=\"hidden\" id=\"template-id_1\" value='name_0[]'> </div> <div class=\"help-block\">byline</div> </div></div>";61 $this->assertEquals($expected, $html);62 }63 public function test_render_error()64 {65 $f = $this->buildFactory();66 $label = "label";67 $byline = "byline";68 $name = "name_0";69 $tags = ["lorem", "ipsum", "dolor",];70 $error = "an_error";71 $text = $f->tag($label, $tags, $byline)->withNameFrom($this->name_source)->withError($error);72 $r = $this->getDefaultRenderer();73 $html = $this->normalizeHTML($r->render($text));74 $expected75 = "<div class=\"form-group row\"> <label for=\"name_0\" class=\"control-label col-sm-3\">label</label> <div class=\"col-sm-9\"> <div id=\"container-id_1\" class=\"form-control form-control-sm il-input-tag\"> <input type=\"text\" id=\"id_1\" value=\"\" class=\"form-control form-control-sm\"/> <input type=\"hidden\" id=\"template-id_1\" value='name_0[]'> </div> <div class=\"help-block\">byline</div> <div class=\"help-block alert alert-danger\" role=\"alert\"> <img border=\"0\" src=\"./templates/default/images/icon_alert.svg\" alt=\"alert\" /> an_error </div> </div></div>";76 $this->assertEquals($expected, $html);77 }78 public function test_render_no_byline()79 {80 $f = $this->buildFactory();81 $label = "label";82 $name = "name_0";83 $tags = ["lorem", "ipsum", "dolor",];84 $text = $f->tag($label, $tags)->withNameFrom($this->name_source);85 $r = $this->getDefaultRenderer();86 $html = $this->normalizeHTML($r->render($text));87 $expected = "<div class=\"form-group row\"> <label for=\"name_0\" class=\"control-label col-sm-3\">label</label> <div class=\"col-sm-9\"> <div id=\"container-id_1\" class=\"form-control form-control-sm il-input-tag\"> <input type=\"text\" id=\"id_1\" value=\"\" class=\"form-control form-control-sm\"/> <input type=\"hidden\" id=\"template-id_1\" value='name_0[]'> </div> </div></div>";88 $this->assertEquals($expected, $html);89 }90 public function test_render_value()91 {92 $f = $this->buildFactory();93 $label = "label";94 $value = ["lorem", "ipsum",];95 $name = "name_0";96 $tags = ["lorem", "ipsum", "dolor",];97 $text = $f->tag($label, $tags)->withValue($value)->withNameFrom($this->name_source);98 $r = $this->getDefaultRenderer();99 $html = $this->normalizeHTML($r->render($text));100 $expected101 = "<div class=\"form-group row\"> <label for=\"name_0\" class=\"control-label col-sm-3\">label</label> <div class=\"col-sm-9\"> <div id=\"container-id_1\" class=\"form-control form-control-sm il-input-tag\"> <input type=\"text\" id=\"id_1\" value=\"lorem,ipsum\" class=\"form-control form-control-sm\"/> <input type=\"hidden\" id=\"template-id_1\" value='name_0[]'> <input type=\"hidden\" id=\"tag-id_1-lorem\" name=\"name_0[]\" value='lorem'> <input type=\"hidden\" id=\"tag-id_1-ipsum\" name=\"name_0[]\" value='ipsum'> </div> </div></div>";102 $this->assertEquals($expected, $html);103 }104 public function test_render_required()105 {106 $f = $this->buildFactory();107 $label = "label";108 $name = "name_0";109 $tags = ["lorem", "ipsum", "dolor",];110 $text = $f->tag($label, $tags)->withNameFrom($this->name_source)->withRequired(true);111 $r = $this->getDefaultRenderer();112 $html = $this->normalizeHTML($r->render($text));113 $expected = "<div class=\"form-group row\"> <label for=\"name_0\" class=\"control-label col-sm-3\">label<span class=\"asterisk\">*</span></label> <div class=\"col-sm-9\"> <div id=\"container-id_1\" class=\"form-control form-control-sm il-input-tag\"> <input type=\"text\" id=\"id_1\" value=\"\" class=\"form-control form-control-sm\"/> <input type=\"hidden\" id=\"template-id_1\" value='name_0[]'> </div> </div></div>";114 $this->assertEquals($expected, $html);115 }116 public function test_render_disabled()117 {118 $f = $this->buildFactory();119 $label = "label";120 $tags = ["lorem", "ipsum", "dolor",];121 $text = $f->tag($label, $tags)->withNameFrom($this->name_source)->withDisabled(true);122 $r = $this->getDefaultRenderer();123 $html = $this->normalizeHTML($r->render($text));124 $expected = "<div class=\"form-group row\"> <label for=\"name_0\" class=\"control-label col-sm-3\">label</label> <div class=\"col-sm-9\"> <div id=\"container-id_1\" class=\"form-control form-control-sm il-input-tag disabled\"> <input type=\"text\" id=\"id_1\" value=\"\" class=\"form-control form-control-sm\"/> <input type=\"hidden\" id=\"template-id_1\" value='name_0[]'> </div> </div></div>";125 $this->assertEquals($expected, $html);126 }127 public function test_value_required()128 {129 $f = $this->buildFactory();130 $label = "label";131 $name = "name_0";132 $tags = ["lorem", "ipsum", "dolor",];133 /** @var \ILIAS\UI\Implementation\Component\Input\Field\Tag $tag */134 $tag = $f->tag($label, $tags)->withNameFrom($this->name_source)->withRequired(true);135 $raw_value1 = ["lorem", "ipsum",];136 $tag1 = $tag->withInput(new DefInputData([$name => $raw_value1]));137 $value1 = $tag1->getContent();138 $this->assertTrue($value1->isOk());139 $value = $value1->value();140 $this->assertEquals($raw_value1, $value);141 }142 public function test_empty_array_as_input_lead_to_exception()143 {144 $f = $this->buildFactory();145 $label = "label";146 $name = "name_0";147 $tags = ["lorem", "ipsum", "dolor",];148 /** @var \ILIAS\UI\Implementation\Component\Input\Field\Tag $tag */149 $tag = $f->tag($label, $tags)->withNameFrom($this->name_source)->withRequired(true);150 $tag2 = $tag->withInput(new DefInputData([$name => []]));151 $result = $tag2->getContent();152 $this->assertTrue($result->isOk());153 $this->assertEquals([], $result->value());154 }155 public function test_null_value_leads_to_exception()156 {157 $f = $this->buildFactory();158 $label = "label";159 $name = "name_0";160 $tags = ["lorem", "ipsum", "dolor",];161 $tag = $f->tag($label, $tags)->withNameFrom($this->name_source)->withRequired(true);162 $tag2 = $tag->withInput(new DefInputData([$name => null]));163 $value2 = $tag2->getContent();164 $this->assertTrue($value2->isError());165 }166 public function test_user_created_not_allowed()167 {168 $f = $this->buildFactory();169 $tags = ["lorem", "ipsum", "dolor",];170 $tag = $f->tag("label", $tags)->withUserCreatedTagsAllowed(false)->withNameFrom($this->name_source);171 $tag1 = $tag->withInput(172 new DefInputData(173 ["name_0" => ["lorem", "ipsum",],]174 )175 );176 $value1 = $tag1->getContent();177 $this->assertTrue($value1->isOk());178 $value = $value1->value();179 $this->assertEquals(180 ["lorem", "ipsum",],181 $value182 );183 $tag1 = $tag->withInput(184 new DefInputData(185 ["name_0" => ["conseptetuer", "ipsum",],]186 )187 );188 $value1 = $tag1->getContent();189 $this->assertTrue($value1->isError());190 }191 public function test_max_tags_ok()192 {193 $f = $this->buildFactory();194 $tag = $f->tag("label", [])->withMaxTags(3)->withNameFrom($this->name_source)->withInput(195 new DefInputData(["name_0" => ["lorem", "ipsum",],])196 );197 $value = $tag->getContent();198 $this->assertTrue($value->isOk());199 }200 public function test_max_tags_not_ok()201 {202 $f = $this->buildFactory();203 $this->expectException(\InvalidArgumentException::class);204 $f->tag("label", [])->withMaxTags(2)->withNameFrom($this->name_source)->withInput(205 new DefInputData(206 ["name_0" => ["lorem", "ipsum", "dolor",],]207 )208 );209 }210 public function test_max_taglength_tags_ok()211 {212 $f = $this->buildFactory();213 $tag = $f->tag("label", [])->withTagMaxLength(10)->withNameFrom($this->name_source)->withInput(214 new DefInputData(["name_0" => ["lorem", "ipsum",],])215 );216 $value = $tag->getContent();217 $this->assertTrue($value->isOk());218 }219 public function test_max_taglength_tags_not_ok()220 {221 $f = $this->buildFactory();222 $this->expectException(\InvalidArgumentException::class);223 $f->tag("label", [])->withTagMaxLength(2)->withNameFrom($this->name_source)->withInput(224 new DefInputData(225 ["name_0" => ["lorem", "ipsum", "dolor",],]226 )227 );228 }229}...
TextareaTest.php
Source:TextareaTest.php
...16 public function setUp() : void17 {18 $this->name_source = new DefNamesource();19 }20 protected function buildFactory()21 {22 $df = new Data\Factory();23 $language = $this->createMock(\ilLanguage::class);24 return new ILIAS\UI\Implementation\Component\Input\Field\Factory(25 new SignalGenerator(),26 $df,27 new ILIAS\Refinery\Factory($df, $language),28 $language29 );30 }31 public function test_implements_factory_interface()32 {33 $f = $this->buildFactory();34 $textarea = $f->textarea("label", "byline");35 $this->assertInstanceOf(Field\Input::class, $textarea);36 $this->assertInstanceOf(Field\Textarea::class, $textarea);37 }38 public function test_implements_factory_interface_without_byline()39 {40 $f = $this->buildFactory();41 $textarea = $f->textarea("label");42 $this->assertInstanceOf(Field\Input::class, $textarea);43 $this->assertInstanceOf(Field\Textarea::class, $textarea);44 }45 public function test_with_min_limit()46 {47 $f = $this->buildFactory();48 $limit = 5;49 $textarea = $f->textarea('label')->withMinLimit($limit);50 $this->assertInstanceOf(Field\Input::class, $textarea);51 $this->assertInstanceOf(Field\Textarea::class, $textarea);52 $this->assertEquals($textarea->getMinLimit(), $limit);53 }54 public function test_with_max_limit()55 {56 $f = $this->buildFactory();57 $limit = 15;58 $textarea = $f->textarea('label')->withMaxLimit($limit);59 $this->assertInstanceOf(Field\Input::class, $textarea);60 $this->assertInstanceOf(Field\Textarea::class, $textarea);61 $this->assertEquals($textarea->getMaxLimit(), $limit);62 }63 public function test_is_limited()64 {65 $f = $this->buildFactory();66 // with min limit67 $textarea = $f->textarea('label')->withMinLimit(5);68 $this->assertTrue($textarea->isLimited());69 // with max limit70 $textarea = $f->textarea('label')->withMaxLimit(5);71 $this->assertTrue($textarea->isLimited());72 // with min-max limit73 $textarea = $f->textarea('label')->withMinLimit(5)->withMaxLimit(20);74 $this->assertTrue($textarea->isLimited());75 // without limit76 $textarea = $f->textarea('label');77 $this->assertFalse($textarea->isLimited());78 }79 public function test_get_min_limit()80 {81 $f = $this->buildFactory();82 $limit = 5;83 $textarea = $f->textarea('label')->withMinLimit($limit);84 $this->assertEquals($textarea->getMinLimit(), $limit);85 }86 public function test_get_max_limit()87 {88 $f = $this->buildFactory();89 $limit = 15;90 $textarea = $f->textarea('label')->withMaxLimit($limit);91 $this->assertEquals($textarea->getMaxLimit(), $limit);92 }93 // RENDERER94 public function test_renderer()95 {96 $f = $this->buildFactory();97 $r = $this->getDefaultRenderer();98 $label = "label";99 $byline = "byline";100 $name = "name_0";101 $textarea = $f->textarea($label, $byline)->withNameFrom($this->name_source);102 $expected = "<div class=\"form-group row\">"103 . "<label for=\"$name\" class=\"control-label col-sm-3\">$label</label>"104 . "<div class=\"col-sm-9\">"105 . "<textarea name=\"$name\" class=\"form-control form-control-sm\"></textarea>"106 . "<div class=\"help-block\">byline</div>"107 . "</div>"108 . "</div>";109 $html = $this->normalizeHTML($r->render($textarea));110 $this->assertHTMLEquals($expected, $html);111 }112 public function test_renderer_with_min_limit()113 {114 $f = $this->buildFactory();115 $r = $this->getDefaultRenderer();116 $name = "name_0";117 $id = "id_1";118 $label = "label";119 $min = 5;120 $byline = "This is just a byline Min: " . $min;121 $textarea = $f->textarea($label, $byline)->withMinLimit($min)->withNameFrom($this->name_source);122 $expected = "<div class=\"form-group row\">"123 . "<label for=\"$name\" class=\"control-label col-sm-3\">$label</label>"124 . "<div class=\"col-sm-9\">"125 . "<textarea name=\"$name\" class=\"form-control form-control-sm\" id=\"$id\"></textarea>"126 . "<div id=\"textarea_feedback_$id\" data-maxchars=\"\"></div>"127 . "<div class=\"help-block\">$byline</div>"128 . "</div>"129 . "</div>";130 $html = $this->normalizeHTML($r->render($textarea));131 $this->assertHTMLEquals($expected, $html);132 }133 public function test_renderer_with_max_limit()134 {135 $f = $this->buildFactory();136 $r = $this->getDefaultRenderer();137 $name = "name_0";138 $id = "id_1";139 $label = "label";140 $max = 20;141 $byline = "This is just a byline Max: " . $max;142 $textarea = $f->textarea($label, $byline)->withMaxLimit($max)->withNameFrom($this->name_source);143 $expected = "<div class=\"form-group row\">"144 . "<label for=\"$name\" class=\"control-label col-sm-3\">$label</label>"145 . "<div class=\"col-sm-9\">"146 . "<textarea name=\"$name\" class=\"form-control form-control-sm\" id=\"$id\"></textarea>"147 . "<div id=\"textarea_feedback_$id\" data-maxchars=\"$max\"></div>"148 . "<div class=\"help-block\">$byline</div>"149 . "</div>"150 . "</div>";151 $html = $this->normalizeHTML($r->render($textarea));152 $this->assertHTMLEquals($expected, $html);153 }154 public function test_renderer_with_min_and_max_limit()155 {156 $f = $this->buildFactory();157 $r = $this->getDefaultRenderer();158 $name = "name_0";159 $id = "id_1";160 $label = "label";161 $min = 5;162 $max = 20;163 $byline = "This is just a byline Min: " . $min . " Max: " . $max;164 $textarea = $f->textarea($label, $byline)->withMinLimit($min)->withMaxLimit($max)->withNameFrom($this->name_source);165 $expected = "<div class=\"form-group row\">"166 . "<label for=\"$name\" class=\"control-label col-sm-3\">$label</label>"167 . "<div class=\"col-sm-9\">"168 . "<textarea name=\"$name\" class=\"form-control form-control-sm\" id=\"$id\"></textarea>"169 . "<div id=\"textarea_feedback_$id\" data-maxchars=\"$max\"></div>"170 . "<div class=\"help-block\">$byline</div>"171 . "</div>"172 . "</div>";173 $html = $this->normalizeHTML($r->render($textarea));174 $this->assertHTMLEquals($expected, $html);175 }176 public function test_renderer_counter_with_value()177 {178 $f = $this->buildFactory();179 $r = $this->getDefaultRenderer();180 $label = "label";181 $byline = "byline";182 $name = "name_0";183 $value = "Lorem ipsum dolor sit";184 $textarea = $f->textarea($label, $byline)->withValue($value)->withNameFrom($this->name_source);185 $expected = "<div class=\"form-group row\">"186 . "<label for=\"$name\" class=\"control-label col-sm-3\">$label</label>"187 . "<div class=\"col-sm-9\">"188 . "<textarea name=\"$name\" class=\"form-control form-control-sm\">$value</textarea>"189 . "<div class=\"help-block\">byline</div>"190 . "</div>"191 . "</div>";192 $html = $this->normalizeHTML($r->render($textarea));193 $this->assertHTMLEquals($expected, $html);194 }195 public function test_renderer_with_error()196 {197 $f = $this->buildFactory();198 $r = $this->getDefaultRenderer();199 $name = "name_0";200 $label = "label";201 $min = 5;202 $byline = "This is just a byline Min: " . $min;203 $error = "an_error";204 $textarea = $f->textarea($label, $byline)->withNameFrom($this->name_source)->withError($error);205 $expected = "<div class=\"form-group row\">"206 . "<label for=\"$name\" class=\"control-label col-sm-3\">$label</label>"207 . "<div class=\"col-sm-9\">"208 . "<textarea name=\"$name\" class=\"form-control form-control-sm\"></textarea>"209 . "<div class=\"help-block\">$byline</div>"210 . "<div class=\"help-block alert alert-danger\" role=\"alert\">"211 . "<img border=\"0\" src=\"./templates/default/images/icon_alert.svg\" alt=\"alert\" />"212 . "$error</div></div></div>";213 $html = $this->normalizeHTML($r->render($textarea));214 $html = trim(preg_replace('/\t+/', '', $html));215 $expected = trim(preg_replace('/\t+/', '', $expected));216 $this->assertEquals($expected, $html);217 }218 public function test_renderer_with_disabled()219 {220 $f = $this->buildFactory();221 $r = $this->getDefaultRenderer();222 $label = "label";223 $byline = "byline";224 $name = "name_0";225 $textarea = $f->textarea($label, $byline)->withNameFrom($this->name_source)->withDisabled(true);226 $expected = "<div class=\"form-group row\">"227 . "<label for=\"$name\" class=\"control-label col-sm-3\">$label</label>"228 . "<div class=\"col-sm-9\">"229 . "<textarea name=\"$name\" disabled=\"disabled\" class=\"form-control form-control-sm\"></textarea>"230 . "<div class=\"help-block\">byline</div>"231 . "</div>"232 . "</div>";233 $html = $this->normalizeHTML($r->render($textarea));234 $this->assertHTMLEquals($expected, $html);235 }236 public function test_stripsTags()237 {238 $f = $this->buildFactory();239 $name = "name_0";240 $text = $f->textarea("")241 ->withNameFrom($this->name_source)242 ->withInput(new DefInputData([$name => "<script>alert()</script>"]));243 $content = $text->getContent();244 $this->assertEquals("alert()", $content->value());245 }246}...
ShowBuildTest.php
Source:ShowBuildTest.php
1<?php2/*3 * This file is part of TechnicPack Solder.4 *5 * (c) Syndicate LLC6 *7 * For the full copyright and license information, please view the LICENSE8 * file that was distributed with this source code.9 */10namespace Tests\Feature;11use App\User;12use App\Build;13use App\Modpack;14use App\Package;15use App\Release;16use BuildFactory;17use Tests\TestCase;18use Illuminate\Foundation\Testing\RefreshDatabase;19class ShowBuildTest extends TestCase20{21 use RefreshDatabase;22 /** @test */23 public function users_can_view_the_requested_build()24 {25 $user = factory(User::class)->create();26 $modpackA = factory(Modpack::class)->create(['slug' => 'modpack-a']);27 $buildA = BuildFactory::createForModpack($modpackA, ['version' => '1.2.3']);28 $modpackB = factory(Modpack::class)->create(['slug' => 'modpack-b']);29 $buildB = BuildFactory::createForModpack($modpackB, ['version' => '1.0.0']);30 $buildC = BuildFactory::createForModpack($modpackB, ['version' => '1.2.3']);31 $response = $this->actingAs($user)->get('/modpacks/modpack-b/1.2.3');32 $response->assertStatus(200);33 $response->assertViewIs('builds.show');34 $this->assertTrue($response->data('build')->is($buildC));35 }36 /** @test */37 public function guests_cannnot_view_build_page()38 {39 $modpack = factory(Modpack::class)->create(['slug' => 'example-modpack']);40 BuildFactory::createForModpack($modpack, ['version' => '1.2.3']);41 $response = $this->get('/modpacks/example-modpack/1.2.3');42 $response->assertRedirect('/login');43 }44 /** @test */45 public function build_releases_are_listed_alphabetically()46 {47 $this->withoutExceptionHandling();48 $user = factory(User::class)->create();49 $modpack = factory(Modpack::class)->create(['slug' => 'example-modpack']);50 $build = BuildFactory::createForModpack($modpack, ['version' => '1.2.3']);51 $packageC = factory(Package::class)->create(['name' => 'Package C']);52 $releaseC = factory(Release::class)->create(['package_id' => $packageC->id]);53 $build->releases()->attach($releaseC);54 $packageB = factory(Package::class)->create(['name' => 'Package B']);55 $releaseB = factory(Release::class)->create(['package_id' => $packageB->id]);56 $build->releases()->attach($releaseB);57 $packageA = factory(Package::class)->create(['name' => 'Package A']);58 $releaseA = factory(Release::class)->create(['package_id' => $packageA->id]);59 $build->releases()->attach($releaseA);60 $response = $this->actingAs($user)->get('/modpacks/example-modpack/1.2.3');61 $response->data('build')->releases->assertEquals([62 $releaseA,63 $releaseB,64 $releaseC,65 ]);66 }67 /** @test */68 public function only_releases_for_the_build_are_included()69 {70 $this->withoutExceptionHandling();71 $user = factory(User::class)->create();72 $modpack = factory(Modpack::class)->create(['slug' => 'example-modpack']);73 $buildA = BuildFactory::createForModpack($modpack, ['version' => '1.2.3']);74 $packageA = factory(Package::class)->create(['name' => 'Package A']);75 $releaseA = factory(Release::class)->create(['package_id' => $packageA->id]);76 $buildA->releases()->attach($releaseA);77 $buildB = BuildFactory::createForModpack($modpack, ['version' => '4.5.6']);78 $packageB = factory(Package::class)->create(['name' => 'Package B']);79 $releaseB = factory(Release::class)->create(['package_id' => $packageB->id]);80 $buildB->releases()->attach($releaseB);81 $response = $this->actingAs($user)->get('/modpacks/example-modpack/1.2.3');82 $response->data('build')->releases->assertContains($releaseA);83 $response->data('build')->releases->assertNotContains($releaseB);84 }85 /** @test */86 public function a_user_cannot_view_a_non_existent_modpack()87 {88 $user = factory(User::class)->create();89 factory(Build::class)->create(['version' => '1.2.3']);90 $response = $this->actingAs($user)->get('/modpacks/fake-modpack/1.2.3');91 $response->assertStatus(404);92 }93 /** @test */94 public function a_user_cannot_view_a_non_existent_build()95 {96 $user = factory(User::class)->create();97 factory(Modpack::class)->create(['slug' => 'example-modpack']);98 $response = $this->actingAs($user)->get('/modpacks/example-modpack/fake-version');99 $response->assertStatus(404);100 }101 /** @test */102 public function packages_are_listed_in_alphabetic_order()103 {104 $user = factory(User::class)->create();105 $modpack = factory(Modpack::class)->create(['slug' => 'example-modpack']);106 BuildFactory::createForModpack($modpack, ['version' => '1.2.3']);107 $packageC = factory(Package::class)->create(['name' => 'Package C']);108 $packageB = factory(Package::class)->create(['name' => 'Package B']);109 $packageA = factory(Package::class)->create(['name' => 'Package A']);110 $response = $this->actingAs($user)->get('/modpacks/example-modpack/1.2.3');111 $response->data('packages')->assertEquals([112 $packageA,113 $packageB,114 $packageC,115 ]);116 }117 /** @test */118 public function modpack_includes_builds_in_reverse_order()119 {120 $this->withoutExceptionHandling();121 $user = factory(User::class)->create();122 $modpack = factory(Modpack::class)->create([123 'slug' => 'example-modpack',124 ]);125 $buildA = BuildFactory::createForModpack($modpack, ['version' => '1.0.0a']);126 $buildB = BuildFactory::createForModpack($modpack, ['version' => '1.0.0b']);127 $buildC = BuildFactory::createForModpack($modpack, ['version' => '10.5']);128 $response = $this->actingAs($user)->get('/modpacks/example-modpack/1.0.0a');129 $response->data('modpack')->builds->assertEquals([130 $buildC,131 $buildB,132 $buildA,133 ]);134 }135}...
buildFactory
Using AI Code Generation
1$factory = new BuildFactory();2$factory->buildFactory();3$factory = new BuildFactory();4$factory->buildFactory();5$factory = new BuildFactory();6$factory->buildFactory();7$factory = new BuildFactory();8$factory->buildFactory();9$factory = new BuildFactory();10$factory->buildFactory();11$factory = new BuildFactory();12$factory->buildFactory();13$factory = new BuildFactory();14$factory->buildFactory();15$factory = new BuildFactory();16$factory->buildFactory();17$factory = new BuildFactory();18$factory->buildFactory();19$factory = new BuildFactory();20$factory->buildFactory();21$factory = new BuildFactory();22$factory->buildFactory();23$factory = new BuildFactory();24$factory->buildFactory();25$factory = new BuildFactory();26$factory->buildFactory();27$factory = new BuildFactory();28$factory->buildFactory();29$factory = new BuildFactory();30$factory->buildFactory();31$factory = new BuildFactory();32$factory->buildFactory();
buildFactory
Using AI Code Generation
1require_once 'is.php';2$factory = new is();3$factory->buildFactory();4require_once 'is.php';5$factory = new is();6$factory->buildFactory();7require_once 'is.php';8$factory = new is();9$factory->buildFactory();10require_once 'is.php';11$factory = new is();12$factory->buildFactory();13require_once 'is.php';14$factory = new is();15$factory->buildFactory();16require_once 'is.php';17$factory = new is();18$factory->buildFactory();19require_once 'is.php';20$factory = new is();21$factory->buildFactory();22require_once 'is.php';23$factory = new is();24$factory->buildFactory();25require_once 'is.php';26$factory = new is();27$factory->buildFactory();28require_once 'is.php';29$factory = new is();30$factory->buildFactory();31require_once 'is.php';32$factory = new is();33$factory->buildFactory();34require_once 'is.php';35$factory = new is();36$factory->buildFactory();37require_once 'is.php';38$factory = new is();39$factory->buildFactory();40require_once 'is.php';41$factory = new is();42$factory->buildFactory();
buildFactory
Using AI Code Generation
1include_once('is.php');2$myIS = new IS();3$myIS->buildFactory('1.php');4include_once('is.php');5$myIS = new IS();6$myIS->buildFactory('2.php');7include_once('is.php');8$myIS = new IS();9$myIS->buildFactory('3.php');10include_once('is.php');11$myIS = new IS();12$myIS->buildFactory('4.php');13include_once('is.php');14$myIS = new IS();15$myIS->buildFactory('5.php');16include_once('is.php');17$myIS = new IS();18$myIS->buildFactory('6.php');19include_once('is.php');20$myIS = new IS();21$myIS->buildFactory('7.php');22include_once('is.php');23$myIS = new IS();24$myIS->buildFactory('8.php');25include_once('is.php');26$myIS = new IS();27$myIS->buildFactory('9.php');28include_once('is.php');29$myIS = new IS();30$myIS->buildFactory('10.php');31include_once('is.php');32$myIS = new IS();33$myIS->buildFactory('11.php');34include_once('is.php');35$myIS = new IS();36$myIS->buildFactory('12.php');37include_once('is.php');
buildFactory
Using AI Code Generation
1include_once("class.php");2$factory = new buildFactory();3$factory->buildFactory();4include_once("class.php");5$factory = new buildFactory();6$factory->buildFactory();7include_once("class.php");8$factory = new buildFactory();9$factory->buildFactory();10include_once("class.php");11$factory = new buildFactory();12$factory->buildFactory();13include_once("class.php");14$factory = new buildFactory();15$factory->buildFactory();16include_once("class.php");17$factory = new buildFactory();18$factory->buildFactory();19include_once("class.php");20$factory = new buildFactory();21$factory->buildFactory();22include_once("class.php");23$factory = new buildFactory();24$factory->buildFactory();25include_once("class.php");26$factory = new buildFactory();27$factory->buildFactory();28include_once("class.php");29$factory = new buildFactory();30$factory->buildFactory();31include_once("class.php");32$factory = new buildFactory();33$factory->buildFactory();34include_once("class.php");35$factory = new buildFactory();36$factory->buildFactory();37include_once("class.php");38$factory = new buildFactory();39$factory->buildFactory();40include_once("class.php");41$factory = new buildFactory();
buildFactory
Using AI Code Generation
1$factory = new isFactory();2$object = $factory->buildFactory('is', 'is');3$factory = new isFactory();4$object = $factory->buildFactory('is', 'is');5$factory = new isFactory();6$object = $factory->buildFactory('is', 'is');7$factory = new isFactory();8$object = $factory->buildFactory('is', 'is');9$factory = new isFactory();10$object = $factory->buildFactory('is', 'is');11$factory = new isFactory();12$object = $factory->buildFactory('is', 'is');13$factory = new isFactory();14$object = $factory->buildFactory('is', 'is');15$factory = new isFactory();16$object = $factory->buildFactory('is', 'is');17$factory = new isFactory();18$object = $factory->buildFactory('is', 'is');19$factory = new isFactory();20$object = $factory->buildFactory('is', 'is');21$factory = new isFactory();22$object = $factory->buildFactory('is', 'is');23$factory = new isFactory();24$object = $factory->buildFactory('is', 'is');25$factory = new isFactory();26$object = $factory->buildFactory('is', 'is');
buildFactory
Using AI Code Generation
1$factory = new isFactory();2$factory->buildFactory('isFactory');3$factory = new isFactory();4$factory->buildFactory('isFactory');5$factory = new isFactory();6$factory->buildFactory('isFactory');7$factory = new isFactory();8$factory->buildFactory('isFactory');9$factory = new isFactory();10$factory->buildFactory('isFactory');11$factory = new isFactory();12$factory->buildFactory('isFactory');13$factory = new isFactory();14$factory->buildFactory('isFactory');15$factory = new isFactory();16$factory->buildFactory('isFactory');17$factory = new isFactory();18$factory->buildFactory('isFactory');19$factory = new isFactory();20$factory->buildFactory('isFactory');21$factory = new isFactory();22$factory->buildFactory('isFactory');23$factory = new isFactory();24$factory->buildFactory('isFactory');25$factory = new isFactory();26$factory->buildFactory('isFactory');27$factory = new isFactory();28$factory->buildFactory('isFactory');29$factory = new isFactory();30$factory->buildFactory('isFactory');31$factory = new isFactory();32$factory->buildFactory('isFactory');33$factory = new isFactory();34$factory->buildFactory('isFactory');35$factory = new isFactory();36$factory->buildFactory('isFactory');
buildFactory
Using AI Code Generation
1$factory = new Factory();2$factory->buildFactory('mysql');3$factory->buildFactory('oracle');4$factory->buildFactory('sql');5$factory->buildFactory('xml');6$factory->buildFactory('csv');
buildFactory
Using AI Code Generation
1$factory = new class extends Factory {2 public function buildFactory($class)3 {4 return new $class;5 }6};7$factory->buildFactory('class2');8$factory = new class extends Factory {9 public function buildFactory($class)10 {11 return new $class;12 }13};14$factory->buildFactory('class3');15$factory = new class extends Factory {16 public function buildFactory($class)17 {18 return new $class;19 }20};21$factory->buildFactory('class4');22$factory = new class extends Factory {23 public function buildFactory($class)24 {25 return new $class;26 }27};28$factory->buildFactory('class5');29$factory = new class extends Factory {30 public function buildFactory($class)31 {32 return new $class;33 }34};35$factory->buildFactory('class6');36$factory = new class extends Factory {37 public function buildFactory($class)38 {39 return new $class;40 }41};42$factory->buildFactory('class7');43$factory = new class extends Factory {44 public function buildFactory($class)45 {46 return new $class;47 }48};49$factory->buildFactory('class8');50$factory = new class extends Factory {51 public function buildFactory($class)52 {53 return new $class;54 }55};56$factory->buildFactory('class9');57$factory = new class extends Factory {58 public function buildFactory($class)59 {60 return new $class;61 }62};63$factory->buildFactory('class10');64$factory = new class extends Factory {
buildFactory
Using AI Code Generation
1$buildFactory = new BuildFactory();2$product = $buildFactory->buildProduct('car');3$product->buildPartA();4$product->buildPartB();5$product->buildPartC();6$buildFactory = new BuildFactory();7$product = $buildFactory->buildProduct('bike');8$product->buildPartA();9$product->buildPartB();10$product->buildPartC();11$buildFactory = new BuildFactory();12$product = $buildFactory->buildProduct('truck');13$product->buildPartA();14$product->buildPartB();15$product->buildPartC();
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Execute automation tests with buildFactory on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.
Test now for FreeGet 100 minutes of automation test minutes FREE!!