1
alain91
Re: Unit testing for Xoops - Starting Class project
  • 2013/8/16 8:26

  • alain91

  • Just popping in

  • Posts: 8

  • Since: 2012/11/11


I'm now been using PHPUNIT for all unit tests.

I have adapted all my previous work to run with PHPUNIT, and I now cover kernel, class and xoops_lib directories.

The next step is to build a continous integration system based on JENKINS.



2
alain91
Re: Unit testing for Xoops - Starting Class project
  • 2013/5/5 13:01

  • alain91

  • Just popping in

  • Posts: 8

  • Since: 2012/11/11


Sorry I'm not using PHPUnitbut Simpletest which is more simple to start with as It comes with an builtin tool to run tests from a browser quite easily.

I have made a repository to keep traces of my unit tests.

See next link : http://xoops-unit-test.googlecode.com/svn/trunk/test/

It is simple to translate from simpletest to PHPUnit the test scripts. The most difficult seems form me, to install PHPUnit framework on my computer and to use it.

Just install the files in the Xoops Root with docs, extra and htdocs. And point the browser to test directory.

Nota: One have to install simpletest framework directly from their web site. The version is 1.1.0 in 2010 but is stable and does the expected job. Install in the root xoops directory.



3
alain91
Re: How to add a customValidationCode to xoopsFormValidate_blockform
  • 2013/4/8 18:30

  • alain91

  • Just popping in

  • Posts: 8

  • Since: 2012/11/11


You are right, there is not way at the moment to get the name of the Form.

But, there is a convention, and the name of the form is 'blockform'

So, just pass this name
class XoopsBlockForm extends XoopsForm
{
    public function 
__construct()
    {
        
parent::__construct('''blockform''');
    }


The red stars :

This works with xhtml but now xoops use HTML5. And html5 have new tags and attributs. One new attribut is named 'required'. using 'required' in an input tag automatically check if the field is empty and display a message in case of error. No javascript in needed.

After few tests, I found the 'required' attribute in input tag ignores the script in javascript. I will continue to investigate.

One could try to use addEelement with false for required parameter.




4
alain91
Re: How to add a customValidationCode to xoopsFormValidate_blockform
  • 2013/4/7 13:08

  • alain91

  • Just popping in

  • Posts: 8

  • Since: 2012/11/11


I don't think it is the final solution, but at the moment, in 2.6.0 alpha2 there is a file named modules/system/blocks/system_blocks.php
Inside there are 2 kind of specific functions b_xxx_show and b_xxx_edit. The former is for display specific content of a block and the later is for editing.

I have modified the b_system_info_edit

function b_system_info_edit($options)
{
    
$block_form = new XoopsBlockForm();
    
$block_form->addElement( new XoopsFormText(_MB_SYSTEM_PWWIDTH'options[0]'13$options[0]), true);
    
$block_form->addElement( new XoopsFormText(_MB_SYSTEM_PWHEIGHT'options[1]'13$options[1]), true);
    
$block_form->addElement( new XoopsFormText(sprintf(_MB_SYSTEM_LOGOXOOPS_URL "/images/"), 'options[2]'5100$options[2]), true);
    
$block_form->addElement(new XoopsFormRadioYN(_MB_SYSTEM_SADMIN'options[3]'$options[3]));
    return 
$block_form->render();
}
which is the code found in main.php block


As You see we can add specific elements and with the parameter 'true' in addElement we can set Rquired to true.

Then with my modification in the render method in blockform.php. The specific fields are displayed and in the html file there are javascript scripts to check if the fields are empty and display an erreur message, in the option part of the form.

I hope this could help.




5
alain91
Re: How to add a customValidationCode to xoopsFormValidate_blockform
  • 2013/4/6 19:14

  • alain91

  • Just popping in

  • Posts: 8

  • Since: 2012/11/11


@irmtfan

could you test the following modification in your configuration ?

Just add the 2 lines starting with @

Indexblockform.php
===================================================================
--- 
blockform.php    (revision 624)
+++ 
blockform.php    (working copy)
@@ -
51,+51,@@
             }
         }
         
$ret .= '';
    @+ 
// next line added
        
@+  $ret .= $this->renderValidationJS(true);
         return 
$ret;
     }
 }

then it would be possible to use for each element added to blockform either customValidationCode[] or either isRequired()




6
alain91
Re: I have some questions/proposals for 2.6
  • 2012/12/22 11:22

  • alain91

  • Just popping in

  • Posts: 8

  • Since: 2012/11/11


I would like to give my two cents with PDO adaptation.

Does someone have a look on xpdo library ?
I used this to adapt an old framework with PDO or PDOlike (compatibiliy for php < 5.2) and this simple library give me the right answer.



7
alain91
Re: XOOPS 2.6.0 Alpha 1 Testing
  • 2012/11/17 21:37

  • alain91

  • Just popping in

  • Posts: 8

  • Since: 2012/11/11


@mage

Je rejoins ce qui a été dit par d'autres.

ce que tu appelles un "mauvais anglais" peut être largement suffisant pour participer aux échanges. Une réponse même en mauvais anglais est plus importante qu'un silence.

J'ai proposé de contribuer. Comment faut-il s'y prendre ?


Edited by Cesag - Translation in english :

@mage
I agree with what has been said by others.

What you call a "bad English" can be more than enough to participate in exchanges. Response even in poor English is more important than silence.

I offered to help. How should it be done?



8
alain91
Re: Roadmap 2.6.0 Discussion
  • 2012/11/17 18:31

  • alain91

  • Just popping in

  • Posts: 8

  • Since: 2012/11/11


@mamba

Could you tell me the best way to contribute to the next 2.6.0 version ?

I'm developper with an more than 5 years of experience in PHP (including work with some frameworks and cms).




TopTop



Login

Who's Online

252 user(s) are online (174 user(s) are browsing Support Forums)


Members: 0


Guests: 252


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits