File tree Expand file tree Collapse file tree 3 files changed +67
-1
lines changed
Expand file tree Collapse file tree 3 files changed +67
-1
lines changed Original file line number Diff line number Diff line change 22
33namespace Prokl \WpSymfonyRouterBundle \Tests \Cases ;
44
5+ use Prokl \TestingTools \Tools \Container \BuildContainer ;
56use Prokl \WordpressCi \Base \WordpressableAjaxTestCase ;
67
78/**
1011 */
1112class SampleAjaxControllerTest extends WordpressableAjaxTestCase
1213{
14+ /**
15+ * @inheritDoc
16+ */
1317 protected function setUp () : void
1418 {
1519 parent ::setup ();
1620 wp_set_current_user ( 1 );
21+
22+ $ this ->container = static ::$ testContainer = BuildContainer::getTestContainer (
23+ [
24+ 'test_container.yaml '
25+ ],
26+ '/../../../../Tests/Fixture '
27+ );
28+
29+ $ this ->container ->get ('wp_ajax.initializer ' );
1730 }
1831
32+ /**
33+ * @return void
34+ */
1935 public function testAction () : void
2036 {
2137 $ this ->_handleAjax ('examples_wp ' );
2238 $ result = $ this ->_last_response ;
2339 $ this ->assertSame ('OK ' , $ result );
2440 }
41+
42+ /**
43+ * @return void
44+ */
45+ public function testActionInvalid () : void
46+ {
47+ $ this ->_handleAjax ('examples_invalid ' );
48+ $ result = $ this ->_last_response ;
49+ $ this ->assertSame ('' , $ result );
50+ }
2551}
Original file line number Diff line number Diff line change @@ -10,4 +10,37 @@ services:
1010 public : true
1111
1212 Prokl\WpSymfonyRouterBundle\Tests\Fixture\FixtureAjaxController : ~
13- Prokl\WpSymfonyRouterBundle\Tests\Fixture\FixtureAjaxControllerInvoke : ~
13+ Prokl\WpSymfonyRouterBundle\Tests\Fixture\FixtureAjaxControllerInvoke : ~
14+
15+ routing.resolver :
16+ class : Symfony\Component\Config\Loader\LoaderResolver
17+ arguments :
18+ - ['@routing.loader.yml']
19+
20+ file_locator :
21+ class : Symfony\Component\Config\FileLocator
22+
23+ routing.loader.yml :
24+ class : Symfony\Component\Routing\Loader\YamlFileLoader
25+ arguments : ['@file_locator']
26+ tags :
27+ - { name: routing.loader }
28+
29+ wp_ajax.loader :
30+ public : true
31+ class : Symfony\Component\Routing\RouteCollection
32+ factory : ['@routing.loader', 'load']
33+ arguments : ['%kernel.project_dir%/../../../Tests/Fixture/wp_routes.yaml']
34+
35+ wp_ajax.initializer :
36+ class : Prokl\WpSymfonyRouterBundle\Services\NativeAjax\WpAjaxInitializer
37+ arguments : ['@wp_ajax.loader', '@service_container']
38+
39+ routing.loader :
40+ class : Symfony\Bundle\FrameworkBundle\Routing\DelegatingLoader
41+ arguments :
42+ - ' @routing.resolver'
43+ - []
44+ - []
45+
46+ Prokl\WpSymfonyRouterBundle\Tests\Fixture\Controller\SampleAjaxController : ~
Original file line number Diff line number Diff line change 1+ examples_wp : # Action роута
2+ path : ' ' # Игнор
3+ methods : [GET, POST]
4+ controller : ' Prokl\WpSymfonyRouterBundle\Tests\Fixture\Controller\SampleAjaxController::action'
5+ defaults :
6+ _public : true
7+
You can’t perform that action at this time.
0 commit comments