Re: [PEPr] Comment on XML::Create_KML
| From: | till | Date: | Fri, 16 Oct 2009 18:08:08 +0000 |
| Subject: | Re: [PEPr] Comment on XML::Create_KML | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-52952@lists.php.net to get a copy of this message | ||
On Fri, Oct 16, 2009 at 8:24 PM, Robert McLeod <hamstar@telescum.co.nz> wrote:
>
> OK cool I'm adjusting some things now... Just a few questions:
>
> 3) What is a unit test?
E.g., through phpUnit.
(I know this will be a steep learning curve, but it's well worth it.)
1) Install phpunit (from http://phpunit.de/)
2) An example testcase
// tests/KMLTestCase.php
class KMLTestCase extends PHPUnit_Framework_TestCase
{
protected $kml;
public function setUp()
{
// Create a new KML object
$this->kml = new KML;
}
public function testIfItWorked()
{
$this->kml->doSomething();
$this->assertEquals('<xml .../>', $this->kml->whatever());
}
}
3) Run with phpunit:
phpunit KMLTestCase.php
This is more or less pseudo code, which serves as an example, and is
not meant to work. :-)
> 4) Its not whether I want to send headers it whether the user of the
> script wants to send headers. Sometimes it is handy to show XML in the
> styled view in firefox. Right?
Yeah, I agree. I was just saying that maybe not do it in the class. ;-)
> 6) How can KML_Place and KML_Style extend from KML_Common when they are
> comletely different objects?
Like that:
//KML/Common.php:
class KML_Common
{}
//KML/Place.php
require_once 'KML/Common.php';
class KML_Place extends KML_Common
{}
>
> 9) __toString is awesome!
>
> I'll have to look into cloning and exceptions before I implement them
> because I don't really understand them...
>
> Cheers for the feedback :)
>
Let me know where you need help!
Till