Skip to content

Commit

Permalink
Merge pull request #3 from verbanent/update/external-tools
Browse files Browse the repository at this point in the history
Added external tools, changed address, license info
  • Loading branch information
radek-ziemniewicz authored Oct 3, 2020
2 parents 27c1460 + 58b08e8 commit 82593f7
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 43 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ coverage
sonar-project.properties
vendor
composer.lock
.scannerwork/
phpunit.*.xml
4 changes: 4 additions & 0 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
build:
environment:
php:
version: '7.4'
7 changes: 7 additions & 0 deletions .styleci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
risky: false
version: 7
preset: psr12
finder:
exclude:
- "vendor"
name: "*.php"
24 changes: 24 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
language: php
sudo: false

php:
- 7.4

cache:
directories:
- $HOME/.composer/cache

addons:
sonarcloud:
organization: "verbanent-public"
token:
secure: "flumy3jpJ+Je/oYe+CglzMCEMJurdOvPOxAkBm6q60vPxgpMTsF9bHuGxxBEuBGleCwqJGArbmctmslPzwpcAkyB39Yy3YuOowwqeT3wmi8Phl7/2vPLKnAlY6Npc6OLi43b8zaufuhUl5hfS2feVxlSaZtbXEvCuajmsZNpDId/nIEPkzH7Wv1tYHAStWUOav8wumB+ej/IRzQFsjvJoKFnGlJm9tsBf+5vq9RXTgcwV88DHOGdgWTyUVU8SUmH99VQ7m4kfiuyQohrjnj5E+CKsOnDY0DGrgchzJnqK2h5xaexgdPGCPLdWu23MS+iamJMA6knVmFcUjzzhFwcVo33EY1ZMHWk4I0sI8xHrENOmfJ83+7AC2fDwJseLqUD18h4HMd5lnFyVdXbJrFOzVmdrAWTUenDXJx6ZMlIfBOFoBOt3k+DfI7UgtW6+KLL+b0d7LjQNdpkwmieYGKbsGm0QsKeytPUpPg8OrpieJZ4LADu69cuHcpB5ZifijKx8mM3CONxi2YYJ/Rro9t9W5Shk1N9ww60uRHlHpyeDFZEtFTXHTFnVhcmPfuaWdoJjPLo8iNNI2FD4YSUOYXHNfr1r165znwF+3KbVFaaxciZfWyordZUSgknFMomRFOM3H5bVnncsgsnZ+HYBon/NUgbK2Z9fWN++jfgLAQekrk="

git:
depth: false

install: composer update --no-interaction --no-suggest --no-progress

script:
- phpdbg -qrr vendor/bin/phpunit --coverage-clover phpunit.coverage.xml --log-junit phpunit.report.xml

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019 Verbanent
Copyright (c) 2020 Radek Ziemniewicz <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
# Ordered binary UUID in Laravel / Eloquent

[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=verbanent_eloquent-binary-uuid&metric=alert_status)](https://sonarcloud.io/dashboard?id=verbanent_eloquent-binary-uuid)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=verbanent_eloquent-binary-uuid&metric=coverage)](https://sonarcloud.io/dashboard?id=verbanent_eloquent-binary-uuid)
[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=verbanent_eloquent-binary-uuid&metric=sqale_rating)](https://sonarcloud.io/dashboard?id=verbanent_eloquent-binary-uuid)
[![StyleCI](https://github.styleci.io/repos/285826449/shield?branch=master)](https://github.styleci.io/repos/285826449)
[![Downloads](https://img.shields.io/packagist/dt/verbanent/eloquent-binary-uuid.svg)](https://packagist.org/packages/verbanent/eloquent-binary-uuid)
[![StyleCI](https://github.styleci.io/repos/285826449/shield?branch=master)](https://github.styleci.io/repos/285826449)
[![CodeFactor](https://www.codefactor.io/repository/github/verbanent/eloquent-binary-uuid/badge)](https://www.codefactor.io/repository/github/verbanent/eloquent-binary-uuid)
[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=verbanent_eloquent-binary-uuid&metric=sqale_rating)](https://sonarcloud.io/dashboard?id=verbanent_eloquent-binary-uuid)
[![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=verbanent_eloquent-binary-uuid&metric=ncloc)](https://sonarcloud.io/dashboard?id=verbanent_eloquent-binary-uuid)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=verbanent_eloquent-binary-uuid&metric=coverage)](https://sonarcloud.io/dashboard?id=verbanent_eloquent-binary-uuid)
![Packagist PHP Version Support](https://img.shields.io/packagist/php-v/verbanent/eloquent-binary-uuid)
![Packagist License](https://img.shields.io/packagist/l/verbanent/eloquent-binary-uuid)

Based on articles about the optimization of UUID storage in databases, I decided to write a simple library that allows this in my projects. I based on the information available here:
https://www.percona.com/blog/2014/12/19/store-uuid-optimized-way/
Expand Down
6 changes: 2 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
"authors": [
{
"name": "Radek Ziemniewicz",
"email": "[email protected]",
"homepage": "https://ziemniewicz.eu",
"role": "Developer"
"email": "[email protected]"
}
],
"autoload": {
Expand Down Expand Up @@ -33,7 +31,7 @@
"ordered",
"uuid"
],
"license": "LGPL-3.0-or-later",
"license": "MIT",
"name": "verbanent/eloquent-binary-uuid",
"description": "Ordered binary UUID in Laravel / Eloquent based on UUID version 1",
"require": {
Expand Down
43 changes: 15 additions & 28 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,29 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit bootstrap = "vendor/autoload.php"
backupGlobals = "false"
backupStaticAttributes = "false"
colors = "true"
convertErrorsToExceptions = "true"
convertNoticesToExceptions = "true"
convertWarningsToExceptions = "true"
processIsolation = "false"
stopOnFailure = "false">

<testsuites>
<testsuite name="Ordered binary UUID in Laravel / Eloquent Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>

<filter>
<whitelist>
<directory suffix=".php">src/</directory>
</whitelist>
</filter>

<php>
<env name="APP_ENV" value="testing"/>
</php>

</phpunit>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" backupGlobals="false" backupStaticAttributes="false" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage>
<include>
<directory suffix=".php">src/</directory>
</include>
</coverage>
<testsuites>
<testsuite name="Ordered binary UUID in Laravel / Eloquent Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<php>
<env name="APP_ENV" value="testing"/>
</php>
</phpunit>
15 changes: 8 additions & 7 deletions tests/Grammars/MySqlGrammarTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
namespace Verbanent\Uuid\Test\Grammars;

use PHPUnit\Framework\TestCase;
use ReflectionException;
use ReflectionMethod;
use Verbanent\Uuid\Grammars\MySqlGrammar;

/**
Expand All @@ -17,11 +19,10 @@ class MySqlGrammarTest extends TestCase
*
* @param string $name
*
* @throws \ReflectionException
*
* @return \ReflectionMethod
* @return ReflectionMethod
* @throws ReflectionException
*/
protected static function getMethod(string $name): \ReflectionMethod
protected static function getMethod(string $name): ReflectionMethod
{
$class = new \ReflectionClass(MySqlGrammar::class);
$method = $class->getMethod($name);
Expand All @@ -33,15 +34,15 @@ protected static function getMethod(string $name): \ReflectionMethod
/**
* Test for MySqlGrammar::typeUuid.
*
* @throws \ReflectionException
* @throws ReflectionException
*/
public function testTypeUuid(): void
{
$mySqlGrammar = new MySqlGrammar();
$typeUuid = self::getMethod('typeUuid');
$uuidMySqlType = $typeUuid->invokeArgs($mySqlGrammar, [new \Illuminate\Support\Fluent()]);

$this->assertIsString($uuidMySqlType, 'Got '.gettype($uuidMySqlType).' instead of string');
$this->assertEquals('binary(16)', $uuidMySqlType, 'Got '.$uuidMySqlType.' instead of \'binary(16)\'');
$this->assertIsString($uuidMySqlType, 'Got ' . gettype($uuidMySqlType) . ' instead of string');
$this->assertEquals('binary(16)', $uuidMySqlType, 'Got ' . $uuidMySqlType . ' instead of \'binary(16)\'');
}
}

0 comments on commit 82593f7

Please sign in to comment.