Skip to content

Commit

Permalink
Merge pull request #18 from Okipa/add-laravel-6-support
Browse files Browse the repository at this point in the history
Add laravel 6 support
  • Loading branch information
Edujugon authored Sep 20, 2019
2 parents e198e13 + 446816e commit 5312ecf
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 22 deletions.
13 changes: 13 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

# Path-based git attributes
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html

# Ignore all test and documentation with "export-ignore".
/.gitattributes export-ignore
/.gitignore export-ignore
/.travis.yml export-ignore
/phpunit.xml.dist export-ignore
/.scrutinizer.yml export-ignore
/tests export-ignore
/.editorconfig export-ignore
/docs export-ignore
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ vendor/
composer.lock
.idea
.DS_Store
TODO.md
TODO.md
.phpunit.result.cache
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
language: php

php:
- 5.5
- 5.6
- 7.0
- 7.1
- 7.2
- 7.3

before_script:
- composer self-update
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# ChangeLog

## V2.0.0

#### Compatibility upgrade

Added support for Laravel 6.
Dropped support for PHP 5.5.


## V1.0.8

#### Fix
Expand All @@ -14,6 +22,7 @@ Renamed global functions name to prevent issues when working with other packages
Added OdooException in get, update and delete methods.
All those methods depend on another method's result to return a correct value.


## V1.0.6

#### New
Expand Down
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
},
"minimum-stability": "dev",
"require": {
"illuminate/support": "^5.1"
"php": "^5.6||^7.0",
"illuminate/support": "^5.1||^6.0"
},
"require-dev": {
"phpunit/phpunit": "~4.8"
"phpunit/phpunit": "~4.8||^8.0"
}
}
3 changes: 1 addition & 2 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false">
stopOnFailure="false">
<testsuites>
<testsuite name="ERP Test Suite">
<directory suffix=".php">./tests/</directory>
Expand Down
6 changes: 6 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ Odoo ERP API for Laravel. [Odoo website](https://www.odoo.com)
[![Latest Stable Version](https://poser.pugx.org/edujugon/laradoo/v/stable)](https://packagist.org/packages/edujugon/laradoo)
[![License](https://poser.pugx.org/edujugon/laradoo/license)](https://packagist.org/packages/edujugon/laradoo)

## Compatibility

| Laravel version | PHP version | Package version |
|---|---|---|
| ^5.1 | ^5.6 | ^V2.0 |
| ^5.1 | ^5.5 | ^V1.1 |

## Installation

Expand Down
32 changes: 16 additions & 16 deletions tests/OdooTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

use Edujugon\Laradoo\Odoo;
use Illuminate\Support\Collection;
use PHPUnit\Framework\TestCase;

class OdooTest extends TestCase
Expand Down Expand Up @@ -44,7 +45,6 @@ protected function setDemoCredentials()
*/
protected function createOdooInstance()
{
//dd('url: ' . $this->host . ' db:' . $this->db . ' user:' . $this->username . ' pass:' . $this->password);
$this->odoo = $this->odoo
->username($this->username)
->password($this->password)
Expand All @@ -59,23 +59,23 @@ public function get_odoo_version_as_collection()
{
$version = $this->odoo->version();

$this->assertInstanceOf(\Illuminate\Support\Collection::class, $version);
$this->assertInstanceOf(Collection::class, $version);
}

/** @test */
public function get_odoo_version_only_server_version()
{
$version = $this->odoo->version('server_version');

$this->assertInternalType('string',$version);
$this->assertEquals('string', gettype($version));
}



/** @test */
public function test_common_connection_odoo()
{
$this->assertInternalType('integer', $this->odoo->getUid());
$this->assertEquals('integer', gettype($this->odoo->getUid()));

}

Expand All @@ -96,7 +96,7 @@ public function using_search_method()
->search('res.partner');

$this->assertArrayNotHasKey('faultCode',$ids);
$this->assertInstanceOf(\Illuminate\Support\Collection::class, $ids);
$this->assertInstanceOf(Collection::class, $ids);
$this->assertNotEmpty($ids);
}

Expand All @@ -105,7 +105,7 @@ public function count_items()
{
$amount = $this->odoo->count('res.partner');

$this->assertInternalType('integer', $amount);
$this->assertEquals('integer', gettype($amount));
}

/** @test */
Expand All @@ -116,7 +116,7 @@ public function get_limited_ids()
->limit(3)
->search('res.partner');

$this->assertInstanceOf(\Illuminate\Support\Collection::class, $ids);
$this->assertInstanceOf(Collection::class, $ids);
$this->assertArrayNotHasKey('faultCode',$ids);
$this->assertCount(3, $ids);
}
Expand All @@ -132,7 +132,7 @@ public function retrieve_a_collection_only_with_field_name()

$this->assertArrayNotHasKey('email',$models->first());
$this->assertArrayHasKey('name',$models->first());
$this->assertInstanceOf(\Illuminate\Support\Collection::class, $models);
$this->assertInstanceOf(Collection::class, $models);
$this->assertArrayNotHasKey('faultCode',$models);
$this->assertCount(3, $models);

Expand All @@ -143,7 +143,7 @@ public function get_fields_of_partner_model()
{
$fields = $this->odoo->fieldsOf('res.partner');

$this->assertInstanceOf(\Illuminate\Support\Collection::class,$fields);
$this->assertInstanceOf(Collection::class, $fields);
$this->assertArrayNotHasKey('faultCode',$fields);
}

Expand All @@ -153,7 +153,7 @@ public function create_new_record()
$id = $this->odoo
->create('res.partner',['name' => 'John Odoo']);

$this->assertInternalType('integer',$id);
$this->assertEquals('integer', gettype($id));
}

/** @test */
Expand All @@ -162,17 +162,17 @@ public function delete_a_record()
$id = $this->odoo
->create('res.partner',['name' => 'John Odoo']);

$this->assertInternalType('integer',$id);
$this->assertEquals('integer', gettype($id));

$result = $this->odoo->deleteById('res.partner',$id);

$ids = $this->odoo
->where('id', $id)
->search('res.partner');

$this->assertEmpty($ids);
$this->assertTrue($ids->isEmpty());

$this->assertInternalType('boolean',$result);
$this->assertEquals('boolean', gettype($result));
}

/** @test */
Expand All @@ -193,9 +193,9 @@ public function delete_two_record()
->where('name', 'John Odoo')
->search('res.partner');

$this->assertEmpty($ids);
$this->assertTrue($ids->isEmpty());

$this->assertInternalType('boolean',$result);
$this->assertEquals('boolean', gettype($result));
}

/** @test */
Expand All @@ -208,7 +208,7 @@ public function delete_a_record_directly()
$result = $this->odoo->where('name', 'John Odoo')
->delete('res.partner');

$this->assertInternalType('boolean',$result);
$this->assertEquals('boolean', gettype($result));
}

/** @test */
Expand Down

0 comments on commit 5312ecf

Please sign in to comment.