Planet Drupal

Subscribe to flux Planet Drupal
Drupal.org - aggregated feeds in category Planet Drupal
Mis à jour : il y a 59 min 18 sec

KnackForge: How to update Drupal 8 core?

sam, 24/03/2018 - 06:01
How to update Drupal 8 core?

Let's see how to update your Drupal site between 8.x.x minor and patch versions. For example, from 8.1.2 to 8.1.3, or from 8.3.5 to 8.4.0. I hope this will help you.

  • If you are upgrading to Drupal version x.y.z

           x -> is known as the major version number

           y -> is known as the minor version number

           z -> is known as the patch version number.

Sat, 03/24/2018 - 10:31
Catégories: Elsewhere

Valuebound: Drupal 8: How to create a custom block programatically

lun, 19/12/2016 - 08:33
Drupal 8: How to create a custom block programatically Jaywant.Topno Mon, 12/19/2016 - 02:33
Catégories: Elsewhere

Valuebound: Drupal 8: Custom Block Creation programmatically

lun, 19/12/2016 - 08:33
Drupal 8: Custom Block Creation programmatically Jaywant.Topno Mon, 12/19/2016 - 02:33
Catégories: Elsewhere

The Sego Blog: Drupal 8, Pantheon & GitKraken: Part 1 of 3

ven, 01/07/2016 - 20:17
07/01/2016Drupal 8, Pantheon & GitKraken: Part 1 of 3

Welcome to the first installment of our three part Drupal 8, Pantheon & GitKraken series.  For more information on what this series will be covering check out our intro HERE.

Catégories: Elsewhere

Freelock : Updating a D6 -> Drupal 8.0.x migration to Drupal 8.1.x

ven, 01/07/2016 - 20:08

We have several Drupal 6 to Drupal 8 upgrade projects going on, which is particularly challenging given how quickly the Drupal Migration system is changing. Given that a couple of them are nearing launch, and were missing some node references, I set out to get the content updated from the production sites before launch.

Drupal 8Drupal MigrationDrupal PlanetDrupal upgrade
Catégories: Elsewhere

Acquia Developer Center Blog: Come on down to Drupal South 2016!

ven, 01/07/2016 - 19:08

Vladimir Roudakov and I sat down at DrupalCon New Orleans to talk about an event close to my heart: the 2016 edition of Drupal South. This year, it'll be held in Australia's Gold Coast. Knowing the Australasian Drupal community, this will be a very high quality event in terms of what you'll be able to get out of it. And knowing the location, right by the world famous "Surfers' Paradise" beach, if you're into sun, fun and Drupal, you'll be in for a treat!

Below is a little information about the event and Vlad, plus video, audio, and a text transcription of our conversation.

Drupal South 2016
Meet Vlad
Interview video - 14 min.

jam: So Vladimir and I are in glamorous downtown New Orleans at DrupalCon 2016 in North America. How’s your Con been so far, Vlad?

Vlad: It was pretty overwhelming. It’s my second Con in the US and third Con altogether and it’s been amazing. Everyone should try it. Everyone should try at least one DrupalCon in their life.

jam: As you can hear from his accent, Vlad is from Australia.

Vlad: Gidday!

jam: You work for Technocrat, right?

Vlad: That’s correct. Yes, I work for a company based in Sydney called Technocrat.

Vlad meets Drupal

jam: How long have you been doing Drupal?

Vlad: I’ve been doing Drupal since 2009. I actually kind of gave up on enterprise back in the day and went to a small company that was run from a basement. The owner came to me with a pile of paper like that and said, “Do you know Drupal?” I said, “I worked with Joomla! before” and he said, “Well, here are all the passwords of my clients. Can you fix the sites?” It was a few Drupal 5 sites and majority of them were Drupal 6 sites. So that’s how I met Drupal. In the basement of the Queensland – well, it’s actually called “Queensland” there – the house. So it’s like in a basement of the house back in Australia.

jam: So your introduction to Drupal was a hundred rescue projects.

Vlad: About 50, yes - not a hundred.

jam: So what did you think about Drupal after opening those up?

Vlad: Well, I don’t think I had time to think about it. I was actually trying to learn it for quite a bit. So just doing it all myself. Yes, it took quite a while and again, was overwhelming but the interest and bit--and still today ... So it was – I guess almost seven years to-date. I keep learning every day, which is – I guess – the most exciting part.

jam: Have you been paying attention to Drupal 8? Have you been excited about that?

Vlad: Yes, I actually just certified as Drupal 8 Acquia certified developer and we just released two projects as a part of Technocrat with at least two Drupal 8 projects into the wild.

jam: Wow! So what are you most excited about, technically in Drupal 8? How is it going to make your job better?

Vlad: Well, it’s already doing it. The fact that it packages a lot of stull than before – we used to use as the modules. So making it more stable is one thing. The second – and I guess the most exciting bit that it kind of comes with hidden gems like a backbone frontend library and Symfony. It’s invisible for a naked eye – for a person who starts doing Drupal 8 or just get introduced for Drupal, but for us as the developers, that brings enormous amount of stuff hidden that we actually can leverage and use. So that’s very, very exciting.

jam: What would you say your favorite thing about Drupal is in all these years?

Vlad: That’s a tough one. There are too many things but I guess community. Yes. So basically, whenever I go to: DrupalCon in the US--I haven’t been to any Drupal events in Europe yet--but in Australia as well. It becomes like a second family.

jam: Yes. I feel really privileged to be able to have close friends that I can see two-three-four-five times a year all over the world in different places and you sort of pick up the conversation that you were having before. It keeps going it – really, it does sort of feel like a family but the good kind of family, I guess.

Drupal South 2016

jam: So you might know that I grew up in New Zealand and you’re on the Drupal South organizing team this year for 2016. When and where is Drupal South going to be this year?

When and Where?

Vlad: So this year, Drupal South is actually coming to the Gold Coast, which is on the east side of Australia. Coming from very cold and rainy Melbourne last year, it actually would be nice to see the sun. So we decided to do it right on the beach on Gold Coast. Originally, Drupal South used to be called Drupal Downunder because Australian and New Zealand events were two different events. So at the moment, they are packed together as Drupal South.

jam: So last week of October – for those of us in the northern hemisphere, if we want one more dose of warm weather, we should come to the Gold Coast. What can people expect from a Drupal South? Is it 80 people in a university basement or what is it like?

Vlad: We keep going back to basements. Now, it’s a – we’re actually going up this year. So I’ll talk about that a bit later but what’s actually happening is a few people came to me during this conference to say, “So what is Drupal South? Is it actually another Drupal camp?” and I’ll say, “No, no, we actually have three Drupal camps in Australia every year and this is an actual conference.” So this is pretty much what – if any of you came to DrupalCon 2013 in Sydney, that’s going to be exactly what it was there. So we are looking at approximately 300-350 people sharing the knowledge. There are some similarities with DrupalCon and the fact that DrupalCon is a big inspiration for me but also it’s going to be a bit different. So there’s going to be a few differences. Talking about the location, the Gold Coast itself, it’s a fun, family destination. We actually are located – I think half a block from the beach. We specifically moved it to October. First of all, not to smash too close together to events like DrupalCon but also because it’s going to be much, much warmer. The Gold Coast is a perfect destination because there are amusement parks, there are entertainment districts. It’s a strip of high rises that people were building since the ‘60s and ‘70s and it’s pretty much like a completely separate city. Actually, a few cities packed together. So it’s very nice. So if you are looking at some family vacations as well as learning or teaching some Drupal, you should definitely come.

International Visitors

jam: Alright! Last week of October, 2016. I have been to the last two Drupal Souths and I was really, really happy. One of the things that I like at different Drupal events is the different mix of people but there were an awful lot of international guests in Melbourne. For example, a lot of people from India, a lot of people from China who I might not see in other places. So you’re expecting about 300 or 400 people. What kind of focus and what kind of activities are there going to be?

Vlad: Well, it’s basically – we are targeting mostly Drupal crowds as usual but this year, it’s a bit different. First of all, I think DrupalCon in Asia changed the perspective in Asia on DrupalCon and a few events like camps happening all over Asia like Manila, Shanghai also, I think to promote Drupal quite a bit. I talked to a few people here and we do expect international guests from India or from China and I think there are a few sponsors that are coming up from there so Australia definitely becoming an international destination in terms of Drupal.

Student Day

Apart from your standard Drupal event where you have a number of sessions, maybe training, a few parties, we’re actually planning a few surprises and one of them – it’s a student day. So actually, at the moment we’re looking at a pre-conference day where we’re trying to get as many students as we can and either go to a local university, which we are trying to work out now. And actually teach Drupal to students or maybe organize a mini conference for them and promote the actual conference. We’re also trying to do that in advance before the conference. So just work with local universities and promote Drupal a bit more.

Conference Sharing

Another thing is conference sharing. Something interest – I realized while traveling to different conferences in Australia, not many people are aware of conferences that are actually happening apart from stuff they’ve been doing for ages. For example, last year I went to WordCamp, WordPress mini conference that was in Brisbane and realized we don’t really have much overlap. There are excellent events happening for Python conference, excellent events put together by Linux Australia – a Linux conference. So what I’m trying to organize is to actually have a table or something to promote other conferences in Australia and New Zealand region to people. So I actually have more people going to PHP conferences next year because it would make sense for people doing Drupal to do that. So that’s another thing.

More hands-on

The last thing we were planning to do is more hands-on session. So usually at DrupalCon, you come and listen to the person for a number of minutes. So say a half-an-hour session or a 45-minute session. So what we are looking at the moment – I’m not sure it’s going to happen – or how it’s going to happen and what format it’s going to be, but we are planning to have a hands-on session where the actual session itself is a mini training course and people can come in and learn about Views not just by watching the presentation but actually will try to present or to actually put together the mini-course so people can actually come and go away with something they built.

jam: Oh! So I can have a concrete achievement from having attended a session like that. That sounds great! That sounds like a really, really, really good idea.

Call for Papers, Call for Sponsors

jam: When is the call for papers? Who should be coming to present? What else do you need?

Vlad: Head to the website to find out more information about sponsorships and sessions as well. So we accept sessions from everyone. If you are using Drupal as a company, if you are planning to use Drupal, if you have any experience in Drupal or so that you want to share, we’re going to have a – not that many actual session tracks but we’ll try to definitely have a distinct line between development, project management, and business. So that’s something that I also have a strong opinion about because a lot of project managers and businesses came to me and said, “Look, we are non-technical people and we also want to share.” On the same note, a lot of advanced developers came in and complained about not having enough advanced session.

jam: Nobody is ever happy ;-)

Vlad: Yes, that’s true but I’m actually trying to cater for that. Although the conference is not very big, we’re really, really trying to do that. So head to the website. There is a sponsor section there. There is a call for paper section there. Submit your session. I’m sure we’re going to have a good conference. One more thing to add is I was talking about heading up before. So one of the things is we are having the conference at Q1 building. It’s the Q1 Resort building. I think it’s an 80-something floor building. So it’s one of the tallest in the Gold Coast. It used to be tallest but someone already built much, much higher. So we’re actually going to split the conference between level two and level 78 and we’re going to have an access to an observation deck. So that’s one of the reasons to actually come in and see the Gold Coast from the level 77 and 78.

jam: What’s that website?

Vlad: The website is goldcoast2016.drupal.org.au.

jam: Alright. I will link to that in the show notes. I just want to say that I’ve been to a PHP conference in a hotel where the sessions were divided between the ground floor and the sixth floor and being in Germany, their elevators are small and slow. Make sure you’ll give us enough time to get between sessions in the elevator. Taking into account how many elevators there are because it jammed up the process at this thing that I’ve been to before.

Vlad: Well, I think we’re not going to split the actual sessions. We’ll either going to do some sponsors talks up in the sky or maybe have a coding lounge or something like that.

jam: That would be cool!

Outta here!

jam: This is Vlad. He’s on the team for Drupal South 2016, which is happening in October and it sounds like it’s going to be a great venue. It sounds like it’ll be a great opportunity to combine it with some vacation time – very, very, very nice. I have been to a couple of these in the past and I really, really enjoyed them and I’ve been to another Drupal conference in Australia and I’ve gotten a lot out of them. So this is a great community. If you want to come and meet some new interesting Drupalists, I would say it’s very, very likely to be a good conference.

Alright Vlad, great talking to you! Have a great rest of DrupalCon. If you could see behind us, the lunch queue is starting to move and yes, it’s time to go get some food. Take care, man. Good to see you.

Vlad: Thanks a lot. Thanks a lot, jam.

Skill Level: BeginnerIntermediateAdvanced
Catégories: Elsewhere

Acquia Developer Center Blog: Extending OOTB Drupal 8 Experiences with Lightning

ven, 01/07/2016 - 17:59

The following post is from the Acquia Lightning blog. Acquia Lightning, “the Drupal distribution for Enterprise Authoring,” is a Drupal starter kit that enables developers to create great authoring experiences and empower editorial teams. Lightning provides users with a lightweight framework for building working solutions in Drupal. For more information, including a product roadmap, and installation instructions, check out the Acquia Lightning site.

Tags: acquia drupal planet
Catégories: Elsewhere

Annertech: One week to get your sessions in for DrupalCon Dublin!

ven, 01/07/2016 - 16:54
One week to get your sessions in for DrupalCon Dublin! With three months left to go before DrupalCon Dublin, event planning is in full swing. Like all Irish Drupal events, Annertech are actively involved in preparations for DrupalCon. Our managing director, Stella Power, has taken on the role of local team lead as well as Business Track chair, and I myself am the Project Management track chair. There's less than a week now to get your sessions submitted for DrupalCon, so it's time to get writing!
Catégories: Elsewhere

Amazee Labs: A new CTO for Amazee Labs Zurich

ven, 01/07/2016 - 15:48
A new CTO for Amazee Labs Zurich

Six years ago the team at Amazee decided to start a Drupal agency called Amazee Labs in Zurich, Switzerland (read more about the Amazee journey) where I worked as a Drupal developer. Over the years, our small team at Amazee Labs grew and my responsibilities as a developer shifted. Suddenly I wasn’t coding all day. I became a team lead and finally CTO. I code much less now than I did during those first years.

Michael Schmid Fri, 07/01/2016 - 15:48

Along with growing the team, we also grew Amazee. We added Amazee Metrics, Amazee Labs in Austin, Amazee Labs in Cape Town, and our newest venture, amazee.io. Each company demanded my attention, so I spent and still spend quite a lot of time in airplanes and on the road.

This growth has been awesome and a never ending journey of new challenges and learning. It’s also been exhausting and caused tensions and bottlenecks some times, as each group waited for my attention and time. Fortunately, this also taught me a very important lesson of good management: letting go.

Let go, enable your team, and make yourself redundant.

This is why I step down as CTO of Amazee Labs Zurich and pass the CTO-torch along to the next person who leads our tech team in Zurich: I’m very happy to announce that Josef Dabernig is our new CTO at Amazee Labs in Zurich from July 1, 2016 on.

Josef joined Amazee Labs in August of 2014 and has demonstrated his leadership and technology skills every day since then. He even taught me an important skill, that sometimes you need to slow down in order to be effective.

I wish Josef all the best with his new role. I am looking forward to see what his team will release. From what I’ve seen so far, they stand to deploy some pretty epic projects in the coming months.
As for me? I’ll be be spending this newfound freedom as the new CTO of Amazee Group, racking up travel miles and providing support and technical guidance for all our companies, specifically amazee.io, which we recently launched back in May.

Catégories: Elsewhere

DrupalEasy: DrupalEasy Podcast 180 - Pimping GovCon (Sarah Thrasher - GovCon)

ven, 01/07/2016 - 15:37

Direct .mp3 file download.

Sarah Thrasher (sarahjean), front-end developer with Acquia, joins Andrew (remember him?), Kelley, and Mike to discuss the upcoming Drupal GovCon, what is means to be a junior developer, how the Drupal community is helping to make sure our community members stays healthy, and we bid farewell to Mike using the word "pimp". All that and our picks of week and five questions!

Interview DrupalEasy News Three Stories Sponsors Picks of the Week Upcoming Events Follow us on Twitter Five Questions (answers only)
  1. Learning Japanese
  2. DrupalVM
  3. Speaking at Drupalcon
  4. Chicken
  5. Before 2008 was a print designer. They had an internal site that needed update so hey, Drupal. Read "Using Drupal" from cover to cover and created the site.
Disclaimer

Sorry about the audio quality in this episode. We had to go to our emergency recording of the call which is only two channels (our regular recording is one channel per participant) and heavily compressed.

Intro Music Subscribe

Subscribe to our podcast on iTunes, Google Play or Miro. Listen to our podcast on Stitcher.

If you'd like to leave us a voicemail, call 321-396-2340. Please keep in mind that we might play your voicemail during one of our future podcasts. Feel free to call in with suggestions, rants, questions, or corrections. If you'd rather just send us an email, please use our contact page.

Catégories: Elsewhere

Zivtech: Challenges of Front End Development

ven, 01/07/2016 - 15:21

With phone in hand, laptop in bag and earbuds in place, the typical user quickly scans multiple sites. If your site takes too long to load, your visitor is gone. If your site isn’t mobile friendly, you’ve lost precious traffic. That’s why it’s essential to build well organized, mobile ready sites.

But how do you get good results?

  • Understand whom you’re building for
  • Employ the right frameworks
  • Organize your codebase
  • Make your life a lot easier with a CSS preprocessor
Let’s look at each of these points.
Design For Mobile When you look at usage statistics, the trend is clear. This chart is from Mary Meeker's 2016 Internet Trends Report.

A vast array of mobile devices accomplish a variety of tasks while running tons of applications. This plethora of device options means that you need to account for a wide assortment of display sizes in the design process.

As a front end developer, it’s vital to consider all possible end users when creating a web experience. Keeping so many display sizes in mind can be a challenge, and responsive design methodologies are useful to tackle that problem.

Frameworks that Work

Bootstrap, Zurb, and Jeet are among the frameworks that developers use to give websites a responsive layout. The concept of responsive web design provides for optimal viewing and interaction across many devices. Media queries are rules that developers write to adapt designs to specific screen widths or height.

Writing these from scratch can be time consuming and repetitive, so frameworks prepackage media queries using common screen size rules. They are worth a try even just as a starting point in a project.

Organizing A Large Code Base Depending on the size of a web project, just the front end code can be difficult to organize. Creating an organizational standard that all developers on a team should follow can be a challenge. Here at Zivtech, we are moving toward the atomic design methodology pioneered by Brad Frost. Taking cues from chemistry, this design paradigm suggests that developers organize code into 5 categories:
  1. Atoms
  2. Molecules
  3. Organisms
  4. Templates
  5. Pages

Basic HTML tags like inputs, labels, and buttons would be considered atoms. Styling atoms can be done in one or more appropriate files. A search form, for example, is considered a molecule composed of a label atom, input atom, and button atom. The search form is styled around its atomic components, which can be tied in as partials or includes. The search form molecule is placed in the context of the header organism, which also contains the logo atom and the primary navigation molecule.

Now Add CSS Preprocessors Although atomic design structure is a great start to organizing code, CSS preprocessors such as Sass are useful tools to streamline the development process. One cool feature of Sass is that it allows developers to define variables so that repetitive code can be defined once and reused throughout.

Here’s an example. If a project uses a specific shade of mint blue (#37FDFC), it can be defined in a Sass file as $mint-blue = #37FDFC. When styling, instead of typing the hex code every time, you can simply use $mint-blue. It makes the code easier to read and understand for the team. Let’s say the client rebrands and wants that blue changed to a slightly lighter shade (#97FFFF). Instead of manually finding all the areas where $mint-blue is referenced on multiples pages of code, a developer can easily revise the variable to equal the new shade ($mint-blue = #97FFFF; ). This change now automatically reflects everywhere $mint-blue was used. Another useful feature of Sass is the ability to nest style rules. Traditionally, with plain CSS, a developer would have to repetitively type the parent selector multiple times to target each child component. With Sass, you can confidently nest styles within a parent tag, as shown below. The two examples here are equivalent, but when you use Sass, it’s a kind of shorthand that automates the process.

Traditional CSS

Sass

Although there are a lot of challenges organizing code and designing for a wide variety of screen sizes, keep in mind that there are excellent tools available to automate the development process, gracefully solve all your front end problems and keep your site traffic healthy.
Catégories: Elsewhere

Nacho Digital: AberdeenCloud is gone! We have 36hs to recover your backups!

ven, 01/07/2016 - 14:50
What's important to learn about the recent AberdeenCloud meltdown? You can not trust your backups and site to a single provider!

Well it is all over the blogosphere, AberdeenCloud breakdown. I already read a couple of articles on the subject and I couldn't agree more with the one from annertech, only way to avoid this kind of issues is offsite backup. I would normally write how to recover from something like this, but sadly as codeenigma explained there isn't much we could do, their servers just collapsed and were gone. But now for 36hs we'll be able to recover our data.

Catégories: Elsewhere

Annertech: The Day that Aberdeen Cloud went Bye-bye

ven, 01/07/2016 - 12:22
The Day that Aberdeen Cloud went Bye-bye This is Tommy, calling from the engine room! Were you affected by the Aberdeen Cloud incident that happened on the 28-06-2016? We weren't, but I'd call that partly luck and partly proactivity. We were actually prepared for this.
Catégories: Elsewhere

DrupalCon News: Call for Papers Closing Soon

jeu, 30/06/2016 - 23:00

It all starts now. Every great DrupalCon session begins as an idea someone shares with our track chairs. There are only a few days left for that next someone to be you.

Catégories: Elsewhere

Acquia Developer Center Blog: Should I Disable PHP Warnings and Notices?

jeu, 30/06/2016 - 22:54

Many developers who work on Drupal (or other web/PHP) projects have error reporting disabled in their local or shared dev environments. They do this for a variety of reasons: some don't know how to enable it, some are annoyed by the frequency of notices, warnings, and errors, and some don't like to be reminded of how many errors are logged.

But there are a few important reasons you should make sure to show all errors when developing:

Tags: acquia drupal planet
Catégories: Elsewhere

Lullabot: Drupal Commerce 2.x with the "Guys" from the Commerce Guys

jeu, 30/06/2016 - 22:00
Matt and Mike sit down to deep-dive into the Drupal 8 version of Drupal Commerce with Ryan Szrama, Bojan Zivanovic, Matt Glamon, in addition to Lullabot's own Matt Robison.
Catégories: Elsewhere

Cruiskeen Consulting: Drupal Camp Wisconsin - Coming soon!

jeu, 30/06/2016 - 20:09

Drupal Camp Wisconsin is on! and will be held on July 29-30 in beautiful Madison Wisconsin. This year we will be meeting at the Chemistry biulding on the UW Campus. There are still open slots for presentations --- so please stop by at http://drupalcampwi.org or make a session proposal, or to sign up for the camp. This is always a fun camp, and it did not happen last year, so this is the year to stop by and make Drupal Camp Wisconsin a success!  See you there.

Catégories: Elsewhere

Drupal core announcements: Drupal 8 and 7 core release window on Wednesday, July 06, 2016

jeu, 30/06/2016 - 19:31
Start:  2016-07-05 12:00 - 2016-07-07 12:00 UTC Organizers:  xjm catch David_Rothstein stefan.r Event type:  Online meeting (eg. IRC meeting)

The monthly core patch (bug fix) release window is this Wednesday, July 06. Drupal 8.1.4 and 7.50 will be released with fixes for Drupal 8 and 7.

To ensure a reliable release window for the patch release, there will be a Drupal 8.1.x commit freeze from 12:00 UTC Tuesday to 12:00 UTC Thursday. Now is a good time to update your development/staging servers to the latest 8.1.x-dev or 7.x-dev code and help us catch any regressions in advance. If you do find any regressions, please report them in the issue queue. Thanks!

To see all of the latest changes that will be included in the releases, see the 8.1.x commit log and 7.x commit log.

Other upcoming core release windows after this week include:

  • Wednesday, July 20 (security release window)
  • Wednesday, August 03 (patch release window)
  • Wednesday, October 5 (scheduled minor release)

Drupal 6 is end-of-life and will not receive further releases.

For more information on Drupal core release windows, see the documentation on release timing and security releases, as well as the Drupal core release cycle overview.

Catégories: Elsewhere

Into my Galaxy: GSoC’ 16: Port Search Configuration Module to Drupal 8 : Mid Terms

jeu, 30/06/2016 - 13:24

I feel really excited to have cleared the mid-Term requirement for my project in Google Summer of Code (GSoC). The results of the mid-Term evaluations were announced June 28, 00:30 IST. This was the evaluation for the first phase of GSoC. In this evaluation process, set up by GSoC organisers, students and mentors have to share their feedback about the current progress of the project. Mentors need to give a pass/ fail grade. Students can continue coding once they clear the evaluations successfully.

I have been working on Porting Search Configuration module to Drupal 8. Please go through my previous posts if you would like to have a look into the past activities in this port process.

Last week I worked on testing some of the units of this module using the Php unit tests framework. Testing is an important process when it comes to any software development process. It plays a crucial role for any software. It helps us to understand the improve our software to the required level by making use of various test cases. We input various values and check whether the tests are passed according to the requirement. If any condition fails to our expectations, we need to make the required changes to suit the application needs.

Php unit tests are generally used to test some units of an application. To check whether the functions implemented gives the expected output, behaviour of the functions in various test cases, giving different types of arguments as inputs to check the errors or flaws for improving the application.

We need to install the Php unit for this process. You could follow this documentation for this process. Furthermore, they give a detailed analysis of the Php Unit Tests.

Once the installation is completed, we can start writing the unit tests for the functionalities we have implemented. The tests are generally stored in the tests/src/Unit directory of the module. The name of the unit test file will be of the format xyzTest.php. All tests are suffixed by ‘Test’. ‘xyz’ can be replaced by the functionality you are going to test.

The following is a simple test to check the sum of two numbers: sumTest.php

<?php class SampleTest extends PHPUnit_Framework_TestCase { public function testSum() { $this->assertEquals(2+2, 4); } } ?>

As mentioned in this above code snippet, we need to create a class, with class name suffixed by ‘Test’ which is an extension of PHPUnit_Framework_TestCase. Now, we need to write the tests inside as member functions. The functions starting with the name test are executed. Here we are checking the sum of the two numbers. This is a very simple demonstration.

The tests are run by using the command PHPUnit. i.e,

$ phpunit tests/src/Unit/sumTest.php

The output generated on running the above test is:

PHPUnit 5.4.6 by Sebastian Bergmann and contributors.

. 1 / 1 (100%)

Time: 252 ms, Memory: 13.25MB

OK (1 test, 1 assertion)

Stay tuned for future updates on this module port.

 


Catégories: Elsewhere

Pages