« first day (1476 days earlier)      last day (3464 days later) » 

4:29 AM
I always find it funny when software people debate about licenses, it is like lawyers debating software architecture :). If someone really cares he should pay a lawyer to understand what he may or may not do, but my personal understanding is more similar to @Sven
 
 
4 hours later…
8:03 AM
@kaiser logos are not subject to software licenses like GPL which are copyright law rules, they are separate under trademark law rules. that's why you can't do something like forking WordPress and calling it Better WordPress — GPL doesn't entitle you to use trademarked name, need to change it (unless trademark holder grants you permission, etc)
same with icons — license lets you use this specific implementation of logo icon, but doesn't give you any rights for logo itself. good sets have that explicit note that logos are property of respective owners.
the good example was with people redistributing paid WP plugins like Gravity Forms. GF cannot sue them for distributing code (because GPL), but can for using trademarked name without permission
 
so if I just take GF plugin and change its name and resell I am off the hook?
 
yes
 
 
4 hours later…
11:42 AM
I'd always suspect the first fork to be called NotWP - just because it is compliant with the rules and thats how "funny" developers are
 
no one is forking it
 
Just think about it. Who would fork?Developers who care about the code and want to refactor it to get cleaner code. But those same kind of people would probably prefer putting this effort into writing something clean from scratch instead of starting from all this legacy code...
 
@Rarst you are probably right, but time will tell
 
time did tell, enough of it passed :)
 
besides maybe it will be somewhat forkable sometime...who knows
@kraftner you are probably right too
 
11:54 AM
@ialocin You mean when all the code is OOP and all legacy spaghetti-code disappeared?
;)
 
@kraftner something like that, I know it seems so very, very unlikely though
but lets talk about it again in 2024 or so
aside from that, I didn't seriously predict a fork, I just was predicting, when it would happen then it would be a "funny" name
just out of honesty, lets call our - imaginary - fork WiP
yea, I'm one of the funny ones too..
ok, enough with that, back to work
 
12:19 PM
live template workflow for WP's register_post_type() in @phpstorm http://i.imgur.com/kSqjGeY.gifv (work in progress)
 
12:30 PM
@Rarst nice, looks and works pretty much like the template I have in Eclipse, minus the dropdowns for the values though
always wanted to ask, is phpstorm that much better, if so, that I should consider changing the iDE?
 
I just discovered how to make dropdowns, suuuper faaancy :)
I never clicked with Eclipse, used NetBeans before storm and never looked back after switching
 
@Rarst @kraftner @ialocin The only reason why someone would fork it was brought up by @hakre: A LTS version for companies.
 
the dropdowns are really nice, I want them too! have to look into that on occasion
@kaiser so little bit like Ubuntu does it, would actually make a lot of sense
 
yes.
@Rarst Is that one the PHPStorm templates?
 
meaning? I made template
 
12:40 PM
@kaiser I remember us talking about this before. Still not convinced it would work. WP depends so much on plugins which already now are often badly maintained. The need to keep them up with LTS and bleeding edge would just make the situtation worse.
 
nav menus are all post types right? There's no taxonomy involved?
 
LTS ... Looooong Term Support - I guess you got something wrong there @kraftner :)
 
they are combination of the two
 
@TomJNowell Menu items are cpt, "menu" are taxonomies
 
I know. But still it is two branches to maintain. Imagine this:
 
12:46 PM
eurgh
I need to export them in WP CLI
 
> Imagine this:
> eurgh
hehe
 
Plugin works fine when LTS is released. Development continues for edge WP version. Later someone discovers a bug or security issue. You need to fix it in both versions. Also as the code for the edge version might have changed the patch isn't all the some. So more work as you need to have two different patches.
 
Yes, people would need to patch older versions. Not that hard as they would actually know that the patch will work for a long time and there wouldn't be an update to kill it.
 
Plus you might need to branch plugins as LTS/edge as well. Which also needs some other update handling in WP as now you only update to latest or you don't. Not to something between.
 
they are already patching older versions, just not too far back
 
12:50 PM
@Rarst The template you made: Are templates able to connect parts like the textdomain?
 
Of WP, but Plugins?
 
@kaiser not that I know how...
 
Aha. You changed one textdomain string and all strings in the function call change?
 
yep
 
because they are connected, somehow...
 
12:52 PM
same template variable
or one template variable defaulting to another
it's tad underdocumented what you can and cannot do there, takes a lot of experimenting
 
Hm. I moved templates out of my brain. Just tried to look it up and can't even find where the templates are.
I mean I know where insert is, but not where I can create them :P
And some shortcodes don't work for me because of German(?) version keyboard I assume
 
so does the exporter pull in all relevant taxonomies on export?
 
Strg + Schrägstrich (forward slash) doesn't work because it's the shift variant of the 7 key.
for example
 
@TomJNowell should
 
1:13 PM
nifty
 
 
2 hours later…
2:45 PM
@toscho i tried this here for a custom post type redirect to meta URL wordpress.stackexchange.com/a/72384/13676
and i end up with original-domain.com/new/slug/parts
if i use https!
actually. it refuses to change example.dev to example.com
 
3:39 PM
@GhostToast I don’t follow. Step by step please, so I can reproduce.
 
 
5 hours later…
9:02 PM
session.cookie_httponly ... HTTPONY
 
9:37 PM
@G.M. You here? Need help with unit testing a db in Silex - in case you can help with that.
 
I don't use silex, but maybe can help. what's the problem? @kaiser
 
I'm basically just trying to mock a DB as I haven't ever figured out how to unit test with a separate DB. My problem seems to be that I use a setup like this one mentioned in the "Controllers in classes" paragraph.
Attaching the route controller looks like this:
$controllers->get(
	'/some-route',
	'\Namespace\Controller\RepositoryController::fooAction'
);
 
and where is DB?
 
and the method (which isn't static at all) is called directly. Now I question myself how I would throw a mocked DB (Doctrine EntityManager object) in there
Everything runs through Pimple - or better: The Silex extended version of Pimple
 
9:44 PM
yes. That's where my problem started
I can't inject anything in the constructor as the Route class which calls the Callback uses a new instance of that method above.
The $controllers->get() method is a wrapper for $controllers->match($pattern, $to), where $to is the callable
So I can't inject anything there. Scratching my head on that for two hours now :P
 
can't you set a mocked version of entity in Pimple for tests?
 
that's what I'm trying... just can't find a way how to do that
 
can you show me a controller code and container (Pimple) code? it's hard talking in abstract
 
I can add you to the Bitbucket repo. Mail?
done
you should have a link in your inbox
Already thought about using just a different database, but not sure how to do that. I never tested a DB before. And this thing does pretty much nothing aside from filling stuff in a DB :)
 
your controller's method receives the app container, put your DB into service, access/replace however you need?
 
9:52 PM
$app['em'] = $app->share( function() use ( $app )
{
	return require __DIR__.'/config/database.php';
} );
 
@kaiser reveived nothing
 
That's pretty much how I currently retrieve the Entitiy Manager
@G.M. can you try to login into Bitbucket and see if you got a new repo?
It's called something with "Airport"
 
$app['em'] = $app->share( function() use ( $app )
{
	return require __DIR__.'/config/database_test.php';
} );
nothing in BitBucket...
 
Hm. Could you check your spam folder?
I just looked at the invitation list and your mail (copy/paste) is there
Hm. Tried to resend the mail.
 
received now
 
9:55 PM
:)
 
there is no tests at the moment?
 
there should be - let me check that
 
sorry, found...
 
Go to "Source" - there's phpunit.xml.dist and the binary is in bin/phpunit, tests are in ./tests
 
PHPUnit mocking is an hell to read :)
 
10:00 PM
Y-E-S
This is just a copy/paste from the same link you pasted above
 
I can suggest you Mockery :)
 
he
looking at this example, which helps nothing
and I can't really find good reads about that
everything is just Symfony2 stuff :P
 
I don't understand WebTest what test
 
First: It's nothing functional atm. Second: It should (when there's a happy end one day) test the route responses.
 
So it's a full end-to-end test, ok
I normally start with unit test
endo write e-2-e only at the end
maybe :)
 
10:10 PM
well. as you can see (if you dig into the app/src folder) there's not really more than fetching stuff from a remote API and stuffing it into a DB. retrieving stuff from the DB (all or specific row) is the only other two tasks.
I wouldn't know what to unit test there :P
 
So test controller class
 
controller class relies on EntityManager/DB/RepositoryResponse
getAllAction(), getLikeAction(), saveAction() ...
 
If I undersstand getAllAction() is called when route is /all
 
nothing to test there without a DB or a mock of it
@G.M. yes
 
I'm writing an example, 2 minutes
Application is in root namespace? @kaiser
 
10:19 PM
yes, should be
 
@kaiser in this way you test the controller pastebin.com/7S2FK2kP
 
At least those five lines of code took you 15 mins :D
Thanks a lot for the help! :)
 
Nothing :)
I spend a lot of time to understand where the request is used in the controller just to understand it is used NOwhere :)
 
yep :)
 
you have to use $this->assertSame not assertSame
 
10:32 PM
If you want to bang your head to a wall, try to get around how the ControllerCollection and the Route work together and how the __call() method is used.
Hint: If you want to make manual backtracing more fun, add beer as dependency and inject it.
wait a second: ArrayAccess? you mean ArrayObject or ArrayIterator?
 
yep sure anything that implements array access
or even an array
Uh there is a problem @kaiser :(
 
:D
ask me
 
Controller use type hinting
 
wat?
 
public function getAllAction( Request $request, Application $app )
getAllAction
 
10:37 PM
?
 
expect Application class, so passing ArrayObject will cause error
You can:
 
ah, yeah, got it
 
- chage Application to ArrayAccess
in controllerr
or inside it, use $app->offsetGet('em')
 
The same goes for Request ... the return value is a PHPUnit foo thing
 
in this way you can mock Application
Request should work
because is Mocked
 
10:41 PM
@param Application|\ArrayAccess $app
to keep storm with typehinting alive :P
Fatal error: Call to a member function setFirstResult() on a non-object in ~\Airports\Controller\RepositoryController.php
Still exactly the same problem
That mock builder returns different stuff than what is actually used in the Controller
 
one sec
first of all use this pastebin.com/x7DgNSqj
and keep your type hinting to Application
I think I've understand the problem
createQueryBuilder is not mocked
@kaiser
 
was mocking two expected values
 
?
	public function getEntityManager()
	{
		$airport = $this->getMock( 'Airports\Entity\Airport' );
		$airport->expects( $this->once() )
			->method( 'getCode' )
			->will( $this->returnValue( 'AAA' ) );
		$airport->expects( $this->once() )
			->method( 'getCity' )
			->will( $this->returnValue( 'Anaa' ) );
		$airport->expects( $this->once() )
			->method( 'getName' )
			->will( $this->returnValue( 'Anaa' ) );
		$airport->expects( $this->once() )
			->method( 'getCountry' )
			->will( $this->returnValue( 'French Polynesia' ) );
where createQueryBuilder is mocked?
getRepository return mocked $airportRepository
 
10:57 PM
I would have assumed it's the return value of $entityManager = $this->getMockBuilder( '\Doctrine\Common\Persistence\ObjectManager' )
The EntityManager used in Doctrine ORM is an instance of \Doctrine\Common\Persistence\ObjectManager iirc
The getRepository() method should return the $airportRepository
 
Yes, but Controller calls createQueryBuilder on $airportRepository
and that method is not mocked
so return NULL
so Controller calls setFirstResult on NULL
and test fails
PS if you want delete the bunch of code above, for your privacy
 
@G.M. delete the getEntityManager() method you posted?
 
?
 
your PS
 
yes
It's your code and is not public
 
11:02 PM
because there could be terrorist attacks on the French Polynesia airport? No worries, I live in Vienna :)
 
:)
btw got the problem?
 
It's not public because it's a toy project and I don't want someone to read up the slightly embarrassing commit history... "update", "big changes", "MAJOR refactoring - no details atm as I ain't got time for that"
branch count: 1
tag count: 0
etc
:)
 
Test works now?
I can post an example with Mockery if you want
 
give me five minutes. need a short break.
 
oook
 
11:14 PM
back
hm. I'm pretty sure mocking the query builder is not a good idea. there must be something native for that...
 
You are mocking everything...
 
yeah, and it seems fucking very wrong
 
No
This is how I would write that test using mockery pastebin.com/PHJG0HC5
Real problem is that you are testing nothing...
Because controller only write thing on DB
and if you mock db...
you are only testing that you can write mocking methods
 
I'm close to returning to phpspec
 
never used
IMHO you should start to create a test DB and write there
 
11:19 PM
> This way, no real class is involved in testing
 
then test that what was written is what you expect
 
That is what I personally find somehow troubling
 
As said, mocking is a good thing when a class elaborate a result form another class
in this case your controller do nothing on results
just json encode them
so pretty make no sense test a mock there
Use my exampe to mock Application
then make it return a real entity manager
that use a test database
and test that what is wrote / read is what you expect
 
Fixtures. First time I read about that.
 
Because you never tested DB or wrote an installer :)
 
11:29 PM
I wrote installers. Even with Doctrine and without ORM. Never needed "base data" before it seems.
But yeah, I never tested a DB before.
 
I rephrase: "you never tested DB or wrote an installer that requires base data" :)
 
:)
this toy project should fill the gap - see how far I got :P
 
currently working on a toy project too, to fill my gap with js frameworks
 
that gap is filled - just unit testing missing there ;)
 
yesterday I wrote this (not related with js fw) github.com/Giuseppe-Mazzapica/Hierarchy
 

« first day (1476 days earlier)      last day (3464 days later) »