Hi everyone.
I am using SimpleBrowser from SimpleTest (http://www.simpletest.org) to login a webmin (http://www.webmin.com/). This login uses https. I've tried two different ways, both fail.
$browser = new SimpleBrowser();
$browser->useCookies();
$browser->useFrames();
//echoes the login page, where it should echo the landing page from a…
I normally use getter and setter methods on my objects and I am fine with testing them as mock objects in SimpleTest by manipulating them with code like:
Mock::generate('MyObj');
$MockMyObj->setReturnValue('getPropName', 'value')
However, I have recently started to use magic interceptors (__set() __get()) and access properties like so:
…
I'd like to use SimpleTest to set up some functionality tests for our project - in particular, we have a very busy page which has some random components and some static components, and I'd like to be able to write a simple test which only confirms the static bits (preferably only the one or two most important ones). In other words, I want to…
I am using SimpleTest version 1.0.1 for a unit test.
I create a new mock object within a test method and on it i do:
$MockDbAdaptor->setReturnValue('query',1);
Now, when i run this in a standalone unit test my tested object is happy to see 1 returned when query() is called on the mock db adaptor.
However, when this exact same test is…
I am using SimpleTest version 1.0.1 for a unit test.
I create a new mock object within a test method and on it i do:
$MockDbAdaptor->setReturnValue('query',1);
Now, when i run this in a standalone unit test my tested object is happy to see 1 returned when query() is called on the mock db adaptor.
However, when this exact same test is…
I have quite a few objects in my system that implement the PHP SPL Iterator interface.
As I write them I also write tests.
I know that writing tests is generally NOT a cut 'n paste job.
But, when it comes to testing classes that implement Standard PHP Library interfaces, surely it makes sense to have a few script snippets that can be…
I'm used to web development using LAMP, PHP5, MySQL plus NetBeans with Xdebug.
Now I want to improve my development, by learning how to use (A) proper testing and (B) a framework. So I have set up CodeIgniter, SimpleTest and the easy Xdebug add-in for Firefox. This is great fun because maroonbytes provided me with clear instructions…
This is my Unit Test class
<?
require_once '../simpletest/unit_tester.php';
require_once '../simpletest/reporter.php';
class Academic extends UnitTestCase
{
function setUp()
{
}
function tearDown()
{
}
function testAc1()
{
}
function testAc4()
{ …
I have a Drupal module that talks to a REST API on a separate server for user registration and authentication. The module runs on multiple sites which point to different servers which may run different versions of the REST API.
Ideally, I'd like to be able to run each site against its own end-point, in case changes on the back end…
Hi everyone,
I have recently heard a lot of people argue about using PHP testing features like PHPunit and SimpleTest together with their IDE of choice (Eclipse for me). After googling the subject, I have still a hard time understanding the pros and cons of using these testing frameworks to speed up development.
If anyone could…
I am trying to get into the habit of writing a unit test before the actual class. What are some pointers the stack overflow community can give me along with any useful resources.
Thank You
It may be a personal quirk of mine, but I like keeping code in living projects up to date - including the libraries/frameworks that they use. Part of it is that I believe a web app is more secure if it is fully patched and up to date. Part of it is just a touch of obsessive compulsiveness on my part.
Over the past seven…
I have just made my first proper little desktop GUI application that basically wraps a GUI (php-gtk) interface around a SimpleTest Web Test case to make it act as a remote testing client.
Each time the local The Web Test case runs, it sends an HTTP request to another SimpleTest case (that has an XHTML interface) sitting…
I use new Eclipse. Create demo test with jUnit (I added default jUnit library built-in Eclipse). Then I write this code:
import junit.framework.*;
import org.junit.Test;
public class SimpleTest extends TestCase {
public SimpleTest(String name) {
super(name);
}
public final void main(String method){
…
As far as I can see, PHPUnit is the only serious product in the field at the moment. It is widely used, is integrated into Continuous Integration suites like phpUnderControl, and well regarded.
The thing is, I don't really like working with PHPUnit. I find it hard to set up (PEAR is the only officially supported…
I've been working on a project for school that takes functions from a class file and turns them into object/classes. The assignment is all about object oriented programming in scheme.
My problem however is that my code doesn't format right.
The output it gives me whenever I give it a file to pass in wraps the…
Hi,
When I write tests in JUnit (in Spring context) I usualy do it like this:
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:testContext.xml")
public class SimpleTest {
@Test
public void testMethod() {
// execute test logic...
}
}
How can I do the same with…
As part of a University project, my team and I have to set up automated unit testing with CruiseControl.rb. We chose to use CodeIgniter for the project, and are having some problems getting everything working together. Does anyone have experience setting up such a configuration? Some of the unit testing…
Often I come across documentation that says "use a regular expression here" I have to spend quite some time digging around trying to work out which regular expression format they are expecting.
As far as I can tell, there are many types of regular expression.
But, at my last place of work I was made…
If i would start on writing a simple Mock framework, then what are the things that a basic mock framework MUST have? Obviously mocking any object, but what about assertions and perhaps other things?
When I think of how I would write my own mock framework then I realise how much I really know (or don't…
I'm in charge of at least one large body of existing PHP code, that desperately needs tests, and as well I need some method of checking the production site for errors.
I've been working with PHP for many years, but am unfortunately new to testing. (Sorry!).
While writing tests for code that has…
Functionally, the two blocks should be the same
<soapenv:Body>
<ns1:login xmlns:ns1="urn:soap.sof.com">
<userInfo>
<username>superuser</username>
<password>qapass</password>
</userInfo>
</ns1:login>
</soapenv:Body>…
I'm trying to teach myself Ruby's Treetop grammar generator. I am finding that not only is the documentation woefully sparse for the "best" one out there, but that it doesn't seem to work as intuitively as I'd hoped.
On a high level, I'd really love a better tutorial than the on-site docs or the…
EDIT: This didn't really start as a hidden features of PHP topic, but thats what it ended up as, so go nuts.
I know this sounds like a point-whoring question but let me explain where I'm coming from.
Out of college I got a job at a PHP shop. I worked there for a year and a half and thought…