{"id":1029,"date":"2014-03-17T12:51:07","date_gmt":"2014-03-17T12:51:07","guid":{"rendered":"http:\/\/www.nickbennett.co.uk\/?p=1029"},"modified":"2023-01-01T13:52:08","modified_gmt":"2023-01-01T13:52:08","slug":"phpunit-dramas","status":"publish","type":"post","link":"https:\/\/blog.nickbennett.co.uk\/index.php\/2014\/03\/17\/phpunit-dramas\/","title":{"rendered":"PHPUnit Dramas"},"content":{"rendered":"<p>A frail <strong>PHPUnit<\/strong> suite is one thing, but one that completely crashes <strong>MySQL<\/strong> is something else entirely!<\/p>\n<p>I wanted to do a quick blog as this problem isn&#8217;t well documented and I want to save people the same pain I went through.<\/p>\n<p>The problem manifested on a rather large suite of tests with a dedicated <strong>MySQL<\/strong> instance. When running the suite we were getting <em>&#8216;database gone away&#8217;<\/em> errors in our <strong>DB unit<\/strong> tests. Our first thoughts were that it was potentially an issue with our out-of-date version of <strong>MySQL<\/strong>. Upon investigation, though it appeared the problem could be replicated and indeed fixed.<\/p>\n<p><span style=\"line-height: 1.5em;\">The problem seemed to be a number of things.<\/span><\/p>\n<ol>\n<li>Multiple table creation scripts for the same table (I know)<\/li>\n<li>Mixing up engine types for tables within the same database<\/li>\n<li>Having MySQL comment blocks in the table creation statements<\/li>\n<li>The use of set foreign constraints statement<\/li>\n<\/ol>\n<p>After much pain, the suite was eventually restored to working order. The lesson learnt was to centralise all of the <strong>DB unit<\/strong> table creation scripts. This ensures 1 point of entry for changes and debugging.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A frail PHPUnit suite is one thing, but one that completely crashes MySQL is something else entirely! I wanted to do a quick blog as this problem isn&#8217;t well documented and I want to save people the same pain I went through. The problem manifested on a rather large suite of tests with a dedicated [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":373,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,12],"tags":[125,155,298,326,327],"class_list":["post-1029","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php","category-technology","tag-database","tag-failures","tag-mysql","tag-php","tag-phpunit"],"_links":{"self":[{"href":"https:\/\/blog.nickbennett.co.uk\/index.php\/wp-json\/wp\/v2\/posts\/1029","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.nickbennett.co.uk\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.nickbennett.co.uk\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.nickbennett.co.uk\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.nickbennett.co.uk\/index.php\/wp-json\/wp\/v2\/comments?post=1029"}],"version-history":[{"count":2,"href":"https:\/\/blog.nickbennett.co.uk\/index.php\/wp-json\/wp\/v2\/posts\/1029\/revisions"}],"predecessor-version":[{"id":1383,"href":"https:\/\/blog.nickbennett.co.uk\/index.php\/wp-json\/wp\/v2\/posts\/1029\/revisions\/1383"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.nickbennett.co.uk\/index.php\/wp-json\/"}],"wp:attachment":[{"href":"https:\/\/blog.nickbennett.co.uk\/index.php\/wp-json\/wp\/v2\/media?parent=1029"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.nickbennett.co.uk\/index.php\/wp-json\/wp\/v2\/categories?post=1029"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.nickbennett.co.uk\/index.php\/wp-json\/wp\/v2\/tags?post=1029"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}