librelist archives

« back to archive

Hard work on the testing side of Photon

Hard work on the testing side of Photon

From:
Loic d'Anterroches
Date:
2011-01-28 @ 13:51
Hello,

just to let you know that the past few days, I have been pushing a lot 
of unit tests in the tree. The goal is to reach a 100% code coverage and 
then, stay there. That is, Photon will be 100% tested.

Once this is completed with the $ photon init myproject being able to 
provide a base mongrel2 config and a ready to use setup, I will push a 
0.1 release out.

I will not make it for January, but early February is the goal. The 
release will include a one page website on http://photon-project.com 
which will be self hosted.

Here is the status:

$ photon selftest
PHPUnit 3.5.5 by Sebastian Bergmann.

............................................................ 60 / 81
.....................

Time: 2 seconds, Memory: 9.00Mb

OK (81 tests, 117 assertions)

Writing code coverage data to XML file, this may take a moment.
Code coverage 1037/1359 (76.31%)

Have a nice WE,
loïc

--
Indefero - Project management and code hosting - http://www.indefero.net
Photon - High Performance PHP Framework - http://photon-project.com
Céondo Ltd - Web + Science = Fun - http://www.ceondo.com

Re: [photon.users] Hard work on the testing side of Photon

From:
William Martin
Date:
2011-01-28 @ 16:12
Hi loic,

I have two technical question about photon, maybe i don't known enough
mongrel2 ...

First,
It's about the Autoloader function
Photon is an application server based on mongrel2 with the PHP backend.
Between two request, does mongrel2 keep the php context / class in memory ?
If yes, we can load all class at the application startup instead of loading
on demand.

Seconds,
Why do you do that : """class Exception extends \Exception {}""" ?

William

On Fri, Jan 28, 2011 at 2:51 PM, Loic d'Anterroches <loic@ceondo.com> wrote:

> Hello,
>
> just to let you know that the past few days, I have been pushing a lot
> of unit tests in the tree. The goal is to reach a 100% code coverage and
> then, stay there. That is, Photon will be 100% tested.
>
> Once this is completed with the $ photon init myproject being able to
> provide a base mongrel2 config and a ready to use setup, I will push a
> 0.1 release out.
>
> I will not make it for January, but early February is the goal. The
> release will include a one page website on http://photon-project.com
> which will be self hosted.
>
> Here is the status:
>
> $ photon selftest
> PHPUnit 3.5.5 by Sebastian Bergmann.
>
> ............................................................ 60 / 81
> .....................
>
> Time: 2 seconds, Memory: 9.00Mb
>
> OK (81 tests, 117 assertions)
>
> Writing code coverage data to XML file, this may take a moment.
> Code coverage 1037/1359 (76.31%)
>
> Have a nice WE,
> loïc
>
> --
> Indefero - Project management and code hosting - http://www.indefero.net
> Photon - High Performance PHP Framework - http://photon-project.com
> Céondo Ltd - Web + Science = Fun - http://www.ceondo.com
>
>


-- 
---------------------------------------------------------
William MARTIN
wysman @NoSpAm@ gmail @DoT@ com

Re: [photon.users] Hard work on the testing side of Photon

From:
Loic d'Anterroches
Date:
2011-01-28 @ 16:34
Hello,

> I have two technical question about photon, maybe i don't known enough
> mongrel2 ...
>
> First,
> It's about the Autoloader function
> Photon is an application server based on mongrel2 with the PHP backend.
> Between two request, does mongrel2 keep the php context / class in memory ?
> If yes, we can load all class at the application startup instead of loading
> on demand.

Because this would require a lot of require at the start and prevent 
dynamic loading of new classes. Because it would require to take care of 
having all these "include_once ..." in the code, which does not look 
nice. So, this is more for convenience and to look nice.

> Seconds,
> Why do you do that : """class Exception extends \Exception {}""" ?

Basically, I create an exception class named Exception local to the 
current namespace. So, suppose I am in the the namespace \photon\core 
and I throw an exception created with this line in the namespace.

namespace photon\core;
class Exception extends \Exception {}

function foo()
{
     throw new Exception('kaboom');
}

function boo()
{
     throw new \Exception('kaboom');
}

If I call this function from somwhere else I can do:

namespace {
try {
     \photon\core\foo();
} catch (\photon\core\Exception $e) {
     // Here I catch only the exception from the core module
     echo "Catched."
}
try {
     \photon\core\bar();
} catch (\photon\core\Exception $e) {
     // Here I catch only the exception from the core module
     echo "Will not be catched, one should have caught \\Exception";
}
}


Basically, it provides a way to "type" the exception easily, that way it 
is easier to know from where it came.

loïc

--
Indefero - Project management and code hosting - http://www.indefero.net
Photon - High Performance PHP Framework - http://photon-project.com
Céondo Ltd - Web + Science = Fun - http://www.ceondo.com

>
> William
>
> On Fri, Jan 28, 2011 at 2:51 PM, Loic d'Anterroches<loic@ceondo.com>  wrote:
>
>> Hello,
>>
>> just to let you know that the past few days, I have been pushing a lot
>> of unit tests in the tree. The goal is to reach a 100% code coverage and
>> then, stay there. That is, Photon will be 100% tested.
>>
>> Once this is completed with the $ photon init myproject being able to
>> provide a base mongrel2 config and a ready to use setup, I will push a
>> 0.1 release out.
>>
>> I will not make it for January, but early February is the goal. The
>> release will include a one page website on http://photon-project.com
>> which will be self hosted.
>>
>> Here is the status:
>>
>> $ photon selftest
>> PHPUnit 3.5.5 by Sebastian Bergmann.
>>
>> ............................................................ 60 / 81
>> .....................
>>
>> Time: 2 seconds, Memory: 9.00Mb
>>
>> OK (81 tests, 117 assertions)
>>
>> Writing code coverage data to XML file, this may take a moment.
>> Code coverage 1037/1359 (76.31%)
>>
>> Have a nice WE,
>> loïc
>>
>> --
>> Indefero - Project management and code hosting - http://www.indefero.net
>> Photon - High Performance PHP Framework - http://photon-project.com
>> Céondo Ltd - Web + Science = Fun - http://www.ceondo.com
>>
>>
>
>

-- 
Dr Loïc d'Anterroches
Founder Céondo Ltd

w: www.ceondo.com       |  e: loic@ceondo.com
t: +44 (0)207 183 0016  |  f: +44 (0)207 183 0124

Céondo Ltd
Dalton House
60 Windsor Avenue
London
SW19 2RR / United Kingdom

Re: [photon.users] Hard work on the testing side of Photon

From:
William Martin
Date:
2011-01-28 @ 16:56
Thanks loic !

On Fri, Jan 28, 2011 at 5:34 PM, Loic d'Anterroches <loic@ceondo.com> wrote:

> Hello,
>
> > I have two technical question about photon, maybe i don't known enough
> > mongrel2 ...
> >
> > First,
> > It's about the Autoloader function
> > Photon is an application server based on mongrel2 with the PHP backend.
> > Between two request, does mongrel2 keep the php context / class in memory
> ?
> > If yes, we can load all class at the application startup instead of
> loading
> > on demand.
>
> Because this would require a lot of require at the start and prevent
> dynamic loading of new classes. Because it would require to take care of
> having all these "include_once ..." in the code, which does not look
> nice. So, this is more for convenience and to look nice.
>
> > Seconds,
> > Why do you do that : """class Exception extends \Exception {}""" ?
>
> Basically, I create an exception class named Exception local to the
> current namespace. So, suppose I am in the the namespace \photon\core
> and I throw an exception created with this line in the namespace.
>
> namespace photon\core;
> class Exception extends \Exception {}
>
> function foo()
> {
>     throw new Exception('kaboom');
> }
>
> function boo()
> {
>     throw new \Exception('kaboom');
> }
>
> If I call this function from somwhere else I can do:
>
> namespace {
> try {
>     \photon\core\foo();
> } catch (\photon\core\Exception $e) {
>     // Here I catch only the exception from the core module
>     echo "Catched."
> }
> try {
>     \photon\core\bar();
> } catch (\photon\core\Exception $e) {
>     // Here I catch only the exception from the core module
>     echo "Will not be catched, one should have caught \\Exception";
> }
> }
>
>
> Basically, it provides a way to "type" the exception easily, that way it
> is easier to know from where it came.
>
> loïc
>
> --
> Indefero - Project management and code hosting - http://www.indefero.net
> Photon - High Performance PHP Framework - http://photon-project.com
> Céondo Ltd - Web + Science = Fun - http://www.ceondo.com
>
> >
> > William
> >
> > On Fri, Jan 28, 2011 at 2:51 PM, Loic d'Anterroches<loic@ceondo.com>
>  wrote:
> >
> >> Hello,
> >>
> >> just to let you know that the past few days, I have been pushing a lot
> >> of unit tests in the tree. The goal is to reach a 100% code coverage and
> >> then, stay there. That is, Photon will be 100% tested.
> >>
> >> Once this is completed with the $ photon init myproject being able to
> >> provide a base mongrel2 config and a ready to use setup, I will push a
> >> 0.1 release out.
> >>
> >> I will not make it for January, but early February is the goal. The
> >> release will include a one page website on http://photon-project.com
> >> which will be self hosted.
> >>
> >> Here is the status:
> >>
> >> $ photon selftest
> >> PHPUnit 3.5.5 by Sebastian Bergmann.
> >>
> >> ............................................................ 60 / 81
> >> .....................
> >>
> >> Time: 2 seconds, Memory: 9.00Mb
> >>
> >> OK (81 tests, 117 assertions)
> >>
> >> Writing code coverage data to XML file, this may take a moment.
> >> Code coverage 1037/1359 (76.31%)
> >>
> >> Have a nice WE,
> >> loïc
> >>
> >> --
> >> Indefero - Project management and code hosting -
> http://www.indefero.net
> >> Photon - High Performance PHP Framework - http://photon-project.com
> >> Céondo Ltd - Web + Science = Fun - http://www.ceondo.com
> >>
> >>
> >
> >
>
> --
> Dr Loïc d'Anterroches
> Founder Céondo Ltd
>
> w: www.ceondo.com       |  e: loic@ceondo.com
> t: +44 (0)207 183 0016  |  f: +44 (0)207 183 0124
>
> Céondo Ltd
> Dalton House
> 60 Windsor Avenue
> London
> SW19 2RR / United Kingdom
>
>


-- 
---------------------------------------------------------
William MARTIN
wysman @NoSpAm@ gmail @DoT@ com