Click here to Skip to main content
15,886,137 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Am installing xmlps software. Installation is done. When I try test, using this ./unittest.sh command.
Am getting a mentioned below error.
*****************************************************************************
root@gains [/home/quotequadsco/pkp/xmlps]# ./unittest.sh
PHPUnit 3.7.29 by Sebastian Bergmann.

Configuration read from /home/quotequadsco/pkp/xmlps/phpunit.xml

.................F

Time: 3.86 seconds, Memory: 42.25Mb

There was 1 failure:

1) ApiTest\Controller\ApiControllerTest::testSubmitAction
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-error
+success

/home/quotequadsco/pkp/xmlps/module/Api/test/ApiTest/Controller/JobControllerTest.php:63

FAILURES!
Tests: 18, Assertions: 56, Failures: 1.

*****************************************************************************

JobControllerTest.php

PHP
<?php

namespace ApiTest\Controller;

use Api\Entity\Job;
use Xmlps\UnitTest\ControllerTest;

class ApiControllerTest extends ControllerTest
{
    protected $document;
    protected $job;
    protected $user;

    protected $testFile = '/tmp/UNITTEST_document.txt';

    protected $citationStyles;

    /**
     * Set up the controller test
     *
     * @return void
     */
    public function setUp()
    {
        parent::setUp();

        $this->citationStyles = $this->sm->get('CitationstyleConversion\Model\Citationstyles');

        $this->resetTestData();
    }

    /**
     * Test if the submit action canot be accessed by guests
     *
     * @return void
     */
    public function testSubmitActionCannotBeAccessedLoggedOut()
    {
        $this->dispatch($this->buildQuery('submit', array(), false));
        $this->assertResponseStatusCode(403);
    }

    /**
     * Test if a job can be submitted
     *
     * @return void
     */
    public function testSubmitAction()
    {
        $styleMap = $this->citationStyles->getStyleMap();
        $keys = array_keys($styleMap);

        $data = array(
            'fileName' => 'Testfile.txt',
            'fileContent' => base64_encode('Test Content'),
            'citationStyleHash' => $keys[0],
        );

        $this->dispatch($this->buildQuery('submit', $data));
        $this->assertResponseStatusCode(200);
        $response = json_decode($this->getResponse()->getContent());
        $this->assertTrue(is_object($response));
        $this->assertSame($response->status, 'success');
        $this->assertNotEmpty($response->id);
    }



How to fix this error. I searched a lot but dint get anything.
Posted

1 solution

Assuming line 63 is
PHP
$this->assertSame($response->status, 'success');

then the value of $response->status is not equal to the string 'success'. You need to check what text it actually contains.
 
Share this answer
 
Comments
Vidhya Raju 6-Nov-14 9:18am    
I checked the content using print_r($response).

Am getting the following output:
******************************
...........F stdClass Object
(
[error]=> File name (filename)parameter is missing.
[status]=> error
[flashMessages]=> Array
(
)
)
*******************************
Richard MacCutchan 6-Nov-14 9:55am    
OK, so now you need to investigate where this information is coming from, and what it means in relation to what your code is trying to do.
Vidhya Raju 8-Nov-14 1:11am    
Actually this is third party code. I need to convert doc to xml. So, I found xmlps software. https://github.com/pkp/xmlps This is the website from where I got that code. Installation is done. But When I test, errors out. Can you pls go through that website and tell me how to fix that error?
Richard MacCutchan 8-Nov-14 4:01am    
Sorry no. I am happy to help you with your code, but I am not going to go and try to fix some third party code that may be doing all sorts of thing wrong.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900