This topic contains 42 replies, has 4 voices, and was last updated by archy_bold 7 years, 11 months ago.
- Topic
Hi,
I followed your guide about setting up the test environment and writting functional tests. I am stuck on my very first testIndex action because I get 401 (authentication failure) where I am expecting 200.
I did:
configured config_test.yml
1app/console oro:install --env test --organization-name Oro --user-name admin --user-email admin@example.com --user-firstname John --user-lastname Doe --user-password admin --sample-data n --application-url http://localhost --force1app/console doctrine:fixture:load --no-debug --append --no-interaction --env=test --fixtures ./vendor/oro/platform/src/Oro/Bundle/TestFrameworkBundle/Fixtures1app/console oro:test:schema:update --env testI see my db populated and user exists with username “admin”
and this my my test:
1234567891011121314151617181920212223242526<?phpnamespace Mekit\Bundle\AccountBundle\Tests\Functional\Controller;use Oro\Bundle\TestFrameworkBundle\Test\WebTestCase;/*** @outputBuffering enabled* @dbIsolation*/class AccountControllerTest extends WebTestCase {protected function setUp() {$this->initClient([],array_merge($this->generateBasicAuthHeader(), array('HTTP_X-CSRF-Header' => 1)));}public function testIndexAction() {$this->client->request('GET', $this->getUrl('mekit_account_index'));$result = $this->client->getResponse();$this->assertHtmlResponseStatusCodeEquals($result, 200);$this->assertContains('Account', $result->getContent());}}… and this is what i get:
123Failed asserting that 401 matches expected 200.Expected :200Actual :401:-(
I even tried without luck:
123456protected function setUp() {$this->initClient([],array_merge($this->generateBasicAuthHeader("admin", "admin"), array('HTTP_X-CSRF-Header' => 1)));}Where do you think I made a mistake out something?
oro/platform(1.6.2) + oro/doctrine-extensions(1.0.7) + symfony/symfony(v2.3.27)
The forum ‘OroPlatform – Programming Questions’ is closed to new topics and replies.