Category: Code

How to run Kong servers with SystemD

Kong is one of my favourite projects, I do like it and keep pushing my current company and most of who I know to use it. So today I’ll talk about installing version 0.10.x and how to run it automatically via SystemD on Ubuntu 16.04.

Let’s talk about installing Kong, basically, we have two steps:

First, installing Kong (this taken from the docs):

This will install Kong correctly on your server successfully.

Continue reading

Filed under: Business, Code, Linux, Nginx

Manually run your Bitbucket Pipelines

In the earlier post, we have talked about how to test your Laravel  application with Bitbucket Pipelines, but sometimes you may need to run the tests on specific commit and not after you push it, luckily for us Bitbucket Pipelines team has implemented the custom section in the ymal file, which helps us to do so.

It does not differ that much from what we already have, so adding the following to our file which we created in the earlier  post will enable us to manually run the pipeline:

Continue reading

Filed under: Code, docker, PHP

How to test your Laravel application with Bitbucket Pipelines

Bitbucket Pipelines is a CI service that you can use to test your application, yes it has its own limitation, but remember it is still new and hopefully it will get better. Today I had the chance to work with it, and trust me I was not planning to do so, am a happy Gitlab-ci user, but why not.

Each of these service has its pros and cons, and am not planning to go over it and list it, just do a small reading to find the differences, so today I’ll talk about how to test your Laravel Application with Bitbucket Pipelines and how you can get it fast.

Requirements:

For sure you need to know Laravel and how to write tests, this post will not talk about it, and it would be nice if you know a little bit of Docker.

Enabling Pipelines:

You will need to enable the pipelines from the Repository Settings as the following image

Continue reading

Filed under: Code, docker, Laravel, PHP

Testing upload file with Slim 3 (a better way)

In my last article, I talked about how we can mock the upload functionality, but without testing the existing of the file, this will work with you without any problem, but now to test the existence of the file we can do it like this:

This is the content of the upload function from the upload controller:

As you can see nothing too fancy, we get the uploaded files, we check that the upload worked then we moved the file to the storage directory, now the testing for the functionality with a real file will be like this:Continue reading

Filed under: Code, PHP

Testing upload file with Slim 3

 

Alert! This may not be the correct way, but sadly enough I didnt find any resources about this topic, most articles talk about Laravel, so if you know better way please write it in the comments. Thanks
Automatic testing may not the best topic I can talk about, at least for now, but it’s something that am committing to learn. So yesterday I was playing with Slim 3 (which is a PHP microframework) and I needed to try and see if I can test a dummy controller which upload a file and store it.

I went to the mighty and only one Google, but most of the articles was about Laravel or how you can mock the file system with vfsStream, and that’s was not what I want, so after playing for few hours I got through 90% of it, as I still need to test the existing of the uploaded file.

So here are my notes, and how I did it:

1- You will need to modify the base test file (BaseTestCase.php), so you can pass to it the uploaded file.

Continue reading

Filed under: Code, PHP